sonic-pi-net / sonic-pi

Code. Music. Live.
https://sonic-pi.net
Other
10.73k stars 918 forks source link

Many keyboard commands not responding #2561

Open alanman opened 3 years ago

alanman commented 3 years ago

Issue: the key commands Enter, Alt-R, Alt-S, and their associated buttons and menu items don't respond all the time.

Expected behavior: Commands do what they're supposed to every time they are given.

Actual behavior: Maybe it'll work? I have pressed Enter 14 times in a row before it actually game me a new line. This number varies. I also have to spam any of the start or stop commands through any method (hotkey, button, menu command) before anything happens. Holding down the command will eventually result in an action. I held down Enter for 10 seconds before it gave me 5 lines, but then it stopped.

Every time I press Alt-R, all the text highlights as expected, but execution doesn't necessarily happen. Look for the gray highlighted text in the log window that says it is starting.

OS: Windows 10, version 2004

Sonic Pi: 3.22, both portable and installed versions

ethancrawford commented 3 years ago

That is ...interesting. I've personally never heard of that issue with Sonic Pi before. What kind of code are you trying to run in Sonic Pi when this happens? is it with any kind of code, or a particular composition? I don't know for sure that it will provide a lot, but it would be helpful to rule out any interesting issues visible in the logs - can you please attach (after you've closed down a session with Sonic Pi that exhibited this behaviour) the contents of the following files in your .sonic-pi\log folder (usually in your home directory): gui.log scsynth.log server-errors.log server-output.log

alanman commented 3 years ago

It happens with anything, even a blank document. It does not appear to be tied to any specific kind of code. Here's a what I wrote today to test the installation version. (Previously I was using the portable version)

live_loop :beeps do
  play rrand(50,100)
  sleep 2
end

And here are the files. gui.log scsynth.log server-errors.log server-output.log

Thanks for looking into it 😃

ethancrawford commented 3 years ago

There is nothing unusual about anything in the logs... except this bit in server-errors.log:

#<Thread:0x0000000006dbad20 C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:925 run> terminated with exception (report_on_exception is true):
C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/promise.rb:46:in `block in deliver!': Promise already delivered. You tried, to deliver true, however already have: true (SonicPi::PromiseAlreadyDeliveredError)
    from C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/promise.rb:44:in `synchronize'
    from C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/promise.rb:44:in `deliver!'
    from C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:957:in `block (3 levels) in __in_thread'
#<Thread:0x00000000074e9470 C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:925 run> terminated with exception (report_on_exception is true):
C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/promise.rb:46:in `block in deliver!': Promise already delivered. You tried, to deliver true, however already have: true (SonicPi::PromiseAlreadyDeliveredError)
    from C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/promise.rb:44:in `synchronize'
    from C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/promise.rb:44:in `deliver!'
    from C:/Program Files/Sonic Pi/app/server/ruby/lib/sonicpi/runtime.rb:957:in `block (3 levels) in __in_thread'

I am not 100% sure why the above would appear, but it does make me wonder if it is related. In my limited understanding of the server code, it's possibly like it's trying to process the Run, but the server thinks it's already received it? 🤷‍♂️ @samaaron is likely to know a bit more about what could be happening here and whether it's the culprit...

ethancrawford commented 3 years ago

In the mean time, does rebooting your computer have any effect?

alanman commented 3 years ago

Alas, no. A reboot does not resolve the issue.

The Promise already delivered may be due to my button spamming and the command finally goes through but like 2 or so at a time. So my guess is it's related, but the after effect of the problem.

ethancrawford commented 3 years ago

@samaaron - is https://github.com/sonic-pi-net/sonic-pi/commit/934c5ffc55c831f6b5fc625f2308723b5038f1ed meant to address this issue?

dethe commented 2 months ago

Don't know if this is related, but I see that in programs when my wireless keyboard has a low battery.