You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On non-Windows machines, the FileSystemScheduleMonitor class persists scheduled timers to "$HOME/data/webjobs\timers" (note the backslash). This causes problems when using a read-only filesystem on non-Windows machines, such as a Linux container.
Steps to reproduce
Create a WebJobs application
Add a package reference to Microsoft.Azure.WebJobs.Extensions v5.0.
Call AddTimers() on the WebJobs Host Builder.
Build and run to verify it works correctly.
Copy the following text into a compose.yaml file:
services:
test-app:
build:
context: "."dockerfile_inline: | FROM mcr.microsoft.com/dotnet/sdk:9.0 as build WORKDIR /src COPY . . RUN dotnet build -c Release RUN dotnet publish -o ./app FROM mcr.microsoft.com/dotnet/runtime:9.0 WORKDIR /app COPY --from=build /src/app . USER app ENTRYPOINT ["dotnet", "test.dll"]# use a read-only OSread_only: truevolumes:
# make tmp folder writable
- target: /tmptype: tmpfstmpfs:
size: 100Mb# make "$HOME/data/webjobs" folder writable
- target: /home/app/data/webjobstype: tmpfstmpfs:
size: 50Mb
Run docker compose up --build.
If I got the Compose syntax correct, the app should build, start, then crash with the error: Unexpected fatal in startup: Read-only file system : '/home/app/data/webjobs\timers'.
Okay, due to the errant backslash, the timers folder is actually named 'webjobs\timers'. So, let's change the volume mount to /home/app/data and try again: docker compose up --wait && docker compose logs --follow. This time it appears to work, but not so fast... Let's restart the container: docker compose restart && docker compose logs --follow. Now it is crashing on start-up again.
Workarounds
There are two known workarounds:
Change the volume mount to $HOME/data/webjobs\timers. This allows my app to work, but as soon as this bug is fixed, my container will fail on startup since $HOME/data/webjobs/timers will be read-only.
Disable read-only filesystem, assuming your company policy allows it (mine does not).
Expected
WebJob Timers should work on read-only filesystem.
The WebJobs "data" folder should be configurable, not hard coded (although I suppose someone could argue that it is "configurable" via the HOME variable. I don't know enough about Linux to know if that is a wise solution or not).
Version Info
.NET SDK 9.0.200
Microsoft.Azure.WebJobs 3.0.41
Microsoft.Azure.WebJobs.Extensions 5.0
TargetFramework: net9.0
The text was updated successfully, but these errors were encountered:
Problem
On non-Windows machines, the
FileSystemScheduleMonitor
class persists scheduled timers to"$HOME/data/webjobs\timers"
(note the backslash). This causes problems when using a read-only filesystem on non-Windows machines, such as a Linux container.Steps to reproduce
Microsoft.Azure.WebJobs.Extensions
v5.0.AddTimers()
on the WebJobs Host Builder.compose.yaml
file:Run
docker compose up --build
.If I got the Compose syntax correct, the app should build, start, then crash with the error:
Unexpected fatal in startup: Read-only file system : '/home/app/data/webjobs\timers'
.Okay, due to the errant backslash, the timers folder is actually named 'webjobs\timers'. So, let's change the volume mount to
/home/app/data
and try again:docker compose up --wait && docker compose logs --follow
. This time it appears to work, but not so fast... Let's restart the container:docker compose restart && docker compose logs --follow
. Now it is crashing on start-up again.Workarounds
There are two known workarounds:
$HOME/data/webjobs\timers
. This allows my app to work, but as soon as this bug is fixed, my container will fail on startup since$HOME/data/webjobs/timers
will be read-only.Expected
Version Info
The text was updated successfully, but these errors were encountered: