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

em-synchrony 1.0.3 and 1.0.4 do not work with ActiveRecord 5.0 #201

Open
zdennis opened this issue Jan 22, 2016 · 13 comments
Open

em-synchrony 1.0.3 and 1.0.4 do not work with ActiveRecord 5.0 #201

zdennis opened this issue Jan 22, 2016 · 13 comments

Comments

@zdennis
Copy link

zdennis commented Jan 22, 2016

For both em-synchrony 1.0.3 and 1.0.4 I get the same undefined local variable or method 'current_connection_id' error with activerecord 5.0.0.beta1.

/Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/em-synchrony-1.0.3/lib/em-synchrony/activerecord.rb:12:in `block in connection': undefined local variable or method `current_connection_id' for #<ActiveRecord::ConnectionAdapters::ConnectionPool:0x007f9d888a4378> (NameError)
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/em-synchrony-1.0.3/lib/em-synchrony/thread.rb:63:in `synchronize'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/em-synchrony-1.0.3/lib/em-synchrony/activerecord.rb:11:in `connection'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.0.beta1/lib/active_record/connection_adapters/abstract/connection_pool.rb:879:in `retrieve_connection'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.0.beta1/lib/active_record/connection_handling.rb:113:in `retrieve_connection'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.0.beta1/lib/active_record/connection_handling.rb:87:in `connection'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.0.beta1/lib/active_record/migration.rb:800:in `connection'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.0.beta1/lib/active_record/migration.rb:807:in `block in method_missing'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.0.beta1/lib/active_record/migration.rb:786:in `block in say_with_time'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/2.2.0/benchmark.rb:288:in `measure'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.0.beta1/lib/active_record/migration.rb:786:in `say_with_time'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.0.beta1/lib/active_record/migration.rb:806:in `method_missing'
    from /Users/zdennis/source/opensource_projects/activerecord-import/test/schema/generic_schema.rb:3:in `block in <top (required)>'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.0.beta1/lib/active_record/schema.rb:48:in `instance_eval'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.0.beta1/lib/active_record/schema.rb:48:in `define'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activerecord-5.0.0.beta1/lib/active_record/schema.rb:44:in `define'
    from /Users/zdennis/source/opensource_projects/activerecord-import/test/schema/generic_schema.rb:1:in `<top (required)>'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.beta1/lib/active_support/dependencies.rb:302:in `require'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.beta1/lib/active_support/dependencies.rb:302:in `block in require'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.beta1/lib/active_support/dependencies.rb:268:in `load_dependency'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/activesupport-5.0.0.beta1/lib/active_support/dependencies.rb:302:in `require'
    from /Users/zdennis/source/opensource_projects/activerecord-import/test/test_helper.rb:50:in `<top (required)>'
    from /Users/zdennis/source/opensource_projects/activerecord-import/test/import_test.rb:1:in `require'
    from /Users/zdennis/source/opensource_projects/activerecord-import/test/import_test.rb:1:in `<top (required)>'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/rake_test_loader.rb:15:in `require'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/rake_test_loader.rb:15:in `block in <main>'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/rake_test_loader.rb:4:in `select'
    from /Users/zdennis/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/rake-10.5.0/lib/rake/rake_test_loader.rb:4:in `<main>'
rake aborted!

I pulled down em-synchrony to add a patch, but after bundling and trying to run the test suite ruby 2.2.3 segfaulted.

@Xanders
Copy link

Xanders commented May 3, 2016

Hello. If you're (or someone) still ineresting in, I've created a branch with ActiveRecord 5 fix:
https://github.com/Xanders/em-synchrony/tree/active_record_5
Use it in Gemfile like:

gem 'em-synchrony', github: 'Xanders/em-synchrony', branch: 'active_record_5', require: %w[em-synchrony em-synchrony/mysql2 em-synchrony/activerecord em-synchrony/em-http em-synchrony/fiber_iterator] # just a sample, fill the require list by yourself

Also it looks like tests was fixed two months ago: 1a232d2
So project is not totally dead. Hope to see EM-Synchrony support in ActiveRecord-Import in the future again...

@dgutov
Copy link
Collaborator

dgutov commented May 3, 2016

@Xanders Hey, is there a reason you've branched your fix not from master, but from a proposed pull request branch?

@Xanders
Copy link

Xanders commented May 9, 2016

@dgutov Yes, it's because my fix is based on changes from that PR, so we should wait for #190 to be merged until it will be possible to merge my fixes.

@dgutov
Copy link
Collaborator

dgutov commented May 9, 2016

my fix is based on changes from that PR

Any particular reason for that?

#190 would have to be rebased first.

@Xanders
Copy link

Xanders commented May 9, 2016

@dgutov Is there any other way to create PR with code using code from other PR except of copy-paste all of that code? I don't understand what the problem now, sorry.

@dgutov
Copy link
Collaborator

dgutov commented May 9, 2016

I'm asking why you've used the approach from that PR and not followed the approach that we currently have in master.

@Xanders
Copy link

Xanders commented May 9, 2016

@dgutov I've tried current master code (both active_record.rb and active_record_4.rb) with AR5 and had a lot of strange errors, didn't know how to fix them. But when i tried fork from #190 it was almost worked except of some moments, that i fixed. I assumed fork is more recent version of synchrony/ar then current master, so I'm forked it, not master.
Was it wrong?

@dgutov
Copy link
Collaborator

dgutov commented May 9, 2016

It's not more recent, no. But it's possible that it uses a better approach, considering you've had to fix fewer places.

@Xanders
Copy link

Xanders commented May 9, 2016

@dgutov So I was wrong, sorry. But I think code from that fork is much simpler and more stable, so I still prefer it.
But note, I didn't write any heavy/complex tests yet, so some bugs may be there.

@dgutov
Copy link
Collaborator

dgutov commented May 9, 2016

Do the existing tests pass?

@Xanders
Copy link

Xanders commented May 9, 2016

@dgutov Only my app's tests. I didn't run synchrony's tests, I don't have much time. It was just a quick fix to force my app working.

@dgutov
Copy link
Collaborator

dgutov commented May 9, 2016

Please let us know the result when you get around to it.

@dgutov
Copy link
Collaborator

dgutov commented Oct 24, 2016

Hey folks, could you please try the current em-synchrony master?

See if it works okay with your AR5 based applications.

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