schell / steeloverseer

A file watcher and development tool.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

AsyncCancelled if command takes a while.

chrissound opened this issue · comments

sos output.raw -c "sleep 0.15; echo 'test'"
Hit Ctrl+C to quit.

Modified: output.raw
[1/1] sleep 0.15; echo 'test'
AsyncCancelled
AsyncCancelled

Modified: output.raw
[1/1] sleep 0.15; echo 'test'
AsyncCancelled
AsyncCancelled

Modified: output.raw
[1/1] sleep 0.15; echo 'test'
AsyncCancelled
AsyncCancelled

Modified: output.raw
[1/1] sleep 0.15; echo 'test'
AsyncCancelled
AsyncCancelled

This only occurs if sleep 0.15 is present. echo 'test' is never run. This used to work without issue (I might have been on an older commit / version).

This occurs with the master branch (3eee0ec).

It works correctly on bc4cce6.

I ran into this problem running pdflatex with no delay but running a later version fixed it.

EDIT 1: I typed too soon! It worked once and then I started getting the same error message as the OP.

I'm writing a latex document using vim and it seems to be a problem with the way vim saves the file. When saving the file in vim it occasionally works but if I touch the file it works every time. I'm using HEAD (3eee0ec).

EDIT 2: And I typed too soon. Again!

pdflatex creates a backup <file>~ which was triggering sos causing an entry that looked like this:

Added: how-to-debug-a-running-process.tex~                                     
[1/2] pdflatex how-to-debug-a-running-process.tex                              
AsyncCancelled                                                                                                                            
AsyncCancelled 

When I changed my match to .*\.tex$ it worked flawlessly.

Sorry for the noise but hopefully this might help someone else who runs into this problem. @schell maybe you could add it to the README?

Thank you for the report @filterfish ! I'll add a blurb about it asap.

I ran into this issue again while working with .tex files, but couldn't find an incantation that worked.

I ended up switching to fswatcher and using that with --throttle 100.

I'm also getting AsyncCancelled in a command, but in my case the command is not taking too long. I think the problem is the input file is getting updated a few times in quick successions which I'm guessing breaks stuff somehow. The sos invocation I'm using:

sos -p "(.*)\.wasm" -c "wasm2wat \1.wasm > \1.wat"

Input files are generated by a compiler and I think they may be updated a few times (e.g. it first crates it, then updates the file contents etc. or maybe flushes the file a few times).

Not sure if relevant, but I'm also seeing these lines when I stop sos with C-c:

Error removing watch: <wd=480>
Error removing watch: <wd=479>
Error removing watch: <wd=478>
Error removing watch: <wd=477>
...

I see a lot of these.

We probably need to add a customizable throttle command like the fswatcher example above.

We probably need to add a customizable throttle command like the fswatcher example above.

Is it not a bug given it worked fine with a previous version? Sounds like a race condition from what I can understand. Looking at the diff between the working/non working commit - possibly a bug upstream as well, or just a change in behavior.