ruby-debug / ruby-debug-ide

An interface which glues ruby-debug to IDEs like Eclipse (RDT), NetBeans and RubyMine.
https://www.jetbrains.com/ruby/features/ruby_debugger.html
Other
371 stars 83 forks source link

Exception: wait: can't add a new key into hash during iteration #136

Open perlun opened 6 years ago

perlun commented 6 years ago

I noted this while running a debug session in VS Code right now. The next time I tried it worked, so it's probably timing related.

/Users/plundberg/.rvm/gems/ruby-2.5.0/gems/ruby-debug-ide-0.6.0/lib/ruby-debug-ide.rb:80:in `wait': can't add a new key into hash during iteration (RuntimeError)
    from /Users/plundberg/.rvm/gems/ruby-2.5.0/gems/ruby-debug-ide-0.6.0/lib/ruby-debug-ide.rb:80:in `block in prepare_debugger'
    from /Users/plundberg/.rvm/gems/ruby-2.5.0/gems/ruby-debug-ide-0.6.0/lib/ruby-debug-ide.rb:79:in `synchronize'
    from /Users/plundberg/.rvm/gems/ruby-2.5.0/gems/ruby-debug-ide-0.6.0/lib/ruby-debug-ide.rb:79:in `prepare_debugger'
    from /Users/plundberg/.rvm/gems/ruby-2.5.0/gems/ruby-debug-ide-0.6.0/lib/ruby-debug-ide.rb:85:in `debug_program'
    from /Users/plundberg/.rvm/gems/ruby-2.5.0/gems/ruby-debug-ide-0.6.0/bin/rdebug-ide:130:in `<top (required)>'
    from /Users/plundberg/.rvm/gems/ruby-2.5.0/bin/rdebug-ide:23:in `load'
    from /Users/plundberg/.rvm/gems/ruby-2.5.0/bin/rdebug-ide:23:in `<main>'
    from /Users/plundberg/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in `eval'
    from /Users/plundberg/.rvm/gems/ruby-2.5.0/bin/ruby_executable_hooks:15:in `<main>'
ViugiNick commented 6 years ago

@perlun It seems that this problem is on the VS Code plugin side. Perhaps it is related to sending a start message to debugger

ViugiNick commented 6 years ago

@perlun @rebornix @seraku24 Most likely the problem is due to the fact that VS Code plugin do not correctly add initial breakpoints. The problem is that after adding each breakpoint, you need to wait for the notification that it was successfully added. Instead, in current implementation all breakpoints adding at the same time, and then all responses are processed. https://github.com/rubyide/vscode-ruby/commit/399145024a8c214d0c9aaeaf00afdf2fdfaf30d8

https://github.com/rubyide/vscode-ruby/blob/0a78aee31818ab976c8a60fea8ce4e4f3acb6067/src/debugger/main.ts#L204

rebornix commented 6 years ago

@ViugiNick thanks for the info. Is there any batch operation that we can add breakpoints at the same time?

ViugiNick commented 6 years ago

@rebornix I have not yet fully understood this limitation, I'll try to get rid of it asap