monome / crow

Crow speaks and listens and remembers bits of text. A scriptable USB-CV-II machine
GNU General Public License v3.0
166 stars 34 forks source link

druid upload freezes after scripts with a stream handler #236

Closed szvsw closed 5 years ago

szvsw commented 5 years ago

the super short summary: if a stream is active when crow receives a u command, the upload will complete successfully and the new script will run, but the next upload will hang (druid pauses after uploading <scriptname>.lua... but before Running: <script>)

this video details how to reliably reproduce. I confirmed a bit more after making the video (see other comment below).

  1. erase_userscript.sh, flash v1.0.1b0
  2. make sure druid is updated 2a. nb: I was using pip3 install --upgrade monome-druid 2b. pip3 show monome-druid returns Version 0.1.1 2c. apologies if I should have been directly installing from the git repo instead somehow...
  3. enter druid
  4. upload scripts without an active stream as many times as you want.
  5. upload a script with an active stream (time<1.1seconds - above that, it seemingly becomes less likely but still possible to produce the bug which begins at step 6). the script will upload and run successfully.
    
    --- stream script

input[1].stream = function(cv) end

function init() input[1].mode('stream',1) end


6. upload any other script - it will upload and run fine, but I believe this is the point where the "bug occurs" from a code perspective (see comment below).
7. upload any other script - it will print `uploading <script>.lua` but will not make it to the `Running:` line. druid is not frozen (yet)
8. if you attempt to execute lua code (e.g. `print.lua`), druid will accept it but receive no response from crow. 
9. druid's current state:
9a. `q` out of druid here; display returns to powershell, but I am not prompting for a new command until after I disconnect or power cycle crow - it just shows a blank line.  after power cycling crow, I receive a command prompt and can then re-enter druid.  the last script uploaded in step 6 (not the attempted script in 7) will run; if that script did not have a stream, I can upload as many scripts as I want.  If it did have a stream, we are essentially about to be at step 6 again - one upload will work, the next will fail.
9b. if I attempt instead of `q`-ing out of druid, I attempt to upload another script in the while crow is in the "hung" state, druid totally freezes until I power cycle crow.
szvsw commented 5 years ago

confirming that streams are the issue:

steps 1-5. are identical

  1. instead of uploading another script, turn off the stream: input[1].mode('none')
  2. you can now upload as many (non-streaming) scripts as you want. the issue does not occur.
szvsw commented 5 years ago

just saw the relevant issue here so I am moving my comments there, sorry to clutter this repo up!