Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RuntimeError: can't add a new key into hash during iteration #12

Closed
klobuczek opened this issue Aug 16, 2022 · 5 comments
Closed

RuntimeError: can't add a new key into hash during iteration #12

klobuczek opened this issue Aug 16, 2022 · 5 comments
Milestone

Comments

@klobuczek
Copy link

Is this possibly async-pool issue?
neo4jrb/neo4j-ruby-driver#191

@ioquatix
Copy link
Member

Yep it could be, let me see if I can reproduce it.

@danielmconrad
Copy link

@ioquatix Any luck reproducing this issue?

@ioquatix
Copy link
Member

I could reproduce it:

> time bundle exec sus
17 passed 1 failed out of 18 total (33 assertions)
🏁 Finished in 142.4ms; 231.805 assertions per second.
🐇 No slow tests found! Well done!

describe Async::Pool::Controller with #close it can acquire resource during close test/async/pool/controller.rb:112
	✗ Unhandled exception RuntimeError: can't add a new key into hash during iteration
		/Users/samuel/Projects/socketry/async-pool/lib/async/pool/controller.rb:255 create_resource
		/Users/samuel/Projects/socketry/async-pool/lib/async/pool/controller.rb:305 get_resource
		/Users/samuel/Projects/socketry/async-pool/lib/async/pool/controller.rb:271 block in available_resource
		/Users/samuel/.gem/ruby/3.1.2/gems/async-2.0.3/lib/async/semaphore.rb:83 acquire
		/Users/samuel/Projects/socketry/async-pool/lib/async/pool/controller.rb:270 available_resource
		/Users/samuel/Projects/socketry/async-pool/lib/async/pool/controller.rb:236 wait_for_resource
		/Users/samuel/Projects/socketry/async-pool/lib/async/pool/controller.rb:96 acquire
		test/async/pool/controller.rb:117 block (6 levels) in <top (required)>
		/Users/samuel/.gem/ruby/3.1.2/gems/sus-0.12.0/lib/sus/mock.rb:34 block in replace
		/Users/samuel/Projects/socketry/async-pool/lib/async/pool/controller.rb:122 each_key
		/Users/samuel/Projects/socketry/async-pool/lib/async/pool/controller.rb:122 close
		test/async/pool/controller.rb:123 block (4 levels) in <top (required)>
		/Users/samuel/.gem/ruby/3.1.2/gems/sus-0.12.0/lib/sus/it.rb:42 block (2 levels) in call
		/Users/samuel/.gem/ruby/3.1.2/gems/sus-0.12.0/lib/sus/base.rb:28 around
		/Users/samuel/.gem/ruby/3.1.2/gems/sus-fixtures-async-0.1.1/lib/sus/fixtures/async/reactor_context.rb:70 block (2 levels) in around
		/Users/samuel/.gem/ruby/3.1.2/gems/sus-fixtures-async-0.1.1/lib/sus/fixtures/async/reactor_context.rb:37 block in run_with_timeout
		/Users/samuel/.gem/ruby/3.1.2/gems/async-2.0.3/lib/async/task.rb:255 block in schedule

@ioquatix ioquatix added this to the v0.3.12 milestone Aug 28, 2022
@danielmconrad
Copy link

Thanks for the update! I pulled in 0.3.12 and ran into an issue with the new code:

NoMethodError:
undefined method `zero?' for nil:NilClass

				if usage.zero?
				        ^^^^^^
				        
File /usr/local/bundle/gems/async-pool-0.3.12/lib/async/pool/controller.rb line 213 in reuse
File /usr/local/bundle/gems/async-pool-0.3.12/lib/async/pool/controller.rb line 99 in release
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/handlers/channel_releasing_reset_response_handler.rb line 24 in reset_completed
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/handlers/reset_response_handler.rb line 13 in on_success
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/async/inbound/inbound_message_dispatcher.rb line 39 in handle_success_message
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/messaging/common/common_message_reader.rb line 32 in unpack_success_message
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/messaging/common/common_message_reader.rb line 16 in read
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/async/pool/channel.rb line 53 in ensure_response_handling
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/async/pool/channel.rb line 39 in write_and_flush
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/async/network_connection.rb line 99 in write_reset_message_if_needed
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/async/network_connection.rb line 73 in release
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/async/connection/direct_connection.rb line 7 in release
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/async/unmanaged_transaction.rb line 206 in handle_transaction_completion
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/async/unmanaged_transaction.rb line 98 in block in close_async
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/util/result_holder.rb line 56 in side
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/async/unmanaged_transaction.rb line 98 in close_async
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/async/unmanaged_transaction.rb line 104 in commit_async
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/internal_transaction.rb line 13 in commit
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/lib/neo4j/driver/synchronizable.rb line 16 in block (4 levels) in with_sync_wrapper
File /usr/local/bundle/gems/async-2.0.3/lib/kernel/sync.rb line 36 in Sync
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/lib/neo4j/driver/synchronizable.rb line 16 in block (3 levels) in with_sync_wrapper
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/internal_session.rb line 58 in block in transaction
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/retry/exponential_backoff_retry_logic.rb line 23 in retry
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/internal_session.rb line 55 in transaction
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/lib/neo4j/driver/synchronizable.rb line 16 in block (4 levels) in with_sync_wrapper
File /usr/local/bundle/gems/async-2.0.3/lib/kernel/sync.rb line 36 in Sync
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/lib/neo4j/driver/synchronizable.rb line 16 in block (3 levels) in with_sync_wrapper
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/ruby/neo4j/driver/internal/internal_session.rb line 45 in write_transaction
File /usr/local/bundle/gems/activegraph-11.1.0.alpha.2/lib/active_graph/transactions.rb line 43 in run_transaction_work
File /usr/local/bundle/gems/activegraph-11.1.0.alpha.2/lib/active_graph/transactions.rb line 37 in block in send_transaction
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/lib/neo4j/driver/auto_closable.rb line 19 in block (3 levels) in with_block_definer
File /usr/local/bundle/gems/neo4j-ruby-driver-4.4.0.alpha.8/lib/neo4j/driver/synchronizable.rb line 16 in block (4 levels) in with_sync_wrapper
File /usr/local/bundle/gems/async-2.0.3/lib/async/task.rb line 255 in block in schedule

@ioquatix
Copy link
Member

Thanks, let me take a look.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants