Skip to content

Synchronization layer #273

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

Merged
merged 16 commits into from
Apr 20, 2015
Merged

Synchronization layer #273

merged 16 commits into from
Apr 20, 2015

Conversation

pitr-ch
Copy link
Member

@pitr-ch pitr-ch commented Apr 7, 2015

link #241

If you agree with the approach I'll merge this PR because of fixes in d66f616 and I'll start migrating all the other classes to this layer in another PR. Event is migrated as an example.

@pitr-ch pitr-ch self-assigned this Apr 7, 2015
@jdantonio
Copy link
Member

I'm sorry for not having an opportunity to provide detailed feedback yet. I'm participating in SpaceApps this weekend and I've been busy preparing. I did look over the PR and I really like the direction you have taken. 👍 Consolidating the helpers into 'engine' is a nice redactor. The fact that it touched so many files is an indication of how necessary that was.

@pitr-ch pitr-ch mentioned this pull request Apr 9, 2015
5 tasks
@pitr-ch pitr-ch added this to the 0.9.0 Release milestone Apr 9, 2015
pitr-ch added 2 commits April 9, 2015 16:01
check the condition at the begging too
@@ -3,16 +3,17 @@
# user that they should use the new implementation instead.

if defined?(Atomic)
warn <<-RUBY
warn <<-TXT
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should consider removing this entirely for 0.9. since this message was introduced in 0.8. We definitely do not want it in the 1.0 release.

@jdantonio
Copy link
Member

👍 I'll rebase #270 and #271 from master once this is merged and get back to work on those updates ASAP.

Thank you!

@pitr-ch
Copy link
Member Author

pitr-ch commented Apr 12, 2015

Thanks for reviewing. Found one more problem which needs fixing. Please do not merge yet.

@pitr-ch
Copy link
Member Author

pitr-ch commented Apr 15, 2015

The issue I've mentioned is fixed in e78b4a5 but I am experiencing failing JRuby tests (e.g. cyclic_barrier), it happens only when whole suite runs, if executed in isolation it's fine :/ I need to find the reason for that before we can merge.

@jdantonio
Copy link
Member

@pitr-ch I'm free this evening. I'll work on it tonight, too. Between the two of us we should be able to figure it out. We're pretty smart dudes. :-)

@jdantonio
Copy link
Member

@pitr-ch OK, so apparently I'm not as smart as I think I am. I am able to consistently reproduce the failed tests on JRuby but I have been unable to isolate the upstream tests that are causing the problem. Have you had any luck?

@pitr-ch
Copy link
Member Author

pitr-ch commented Apr 18, 2015

Thanks @jdantonio, did you find out anything? I've also continued digging, so far I have:

  • if JRuby compilation is disabled (-J-Djruby.compile.mode=OFF) it works as expected
  • if debugging prints are added
    • ns_wait_until reports its return value correctly
    • any print in CyclicBarrier#wait is skipped, it looks like the body of this method is skipped too, it returns in the spec where the barrier's state looks like the body of wait was skipped
  • reproducer: only cyclic_barrier_spec where spec breaks the barrier and release all other threads is run 100x until it compiles and starts to fail, on jruby-1.7.19
  • I've also tried pure Java version of JavaSynchronizedObject, it fails too.

I am going to sleep on it before deciding what to do next :)

update: I've read your comment after posting this. I am also feeling pretty dumb, after 3 days of intermittent investigation.

@pitr-ch
Copy link
Member Author

pitr-ch commented Apr 18, 2015

It looks like if while true is replaced with loop do at https://github.com/ruby-concurrency/concurrent-ruby/blob/synchronization/lib/concurrent/synchronized_object.rb#L80 it starts to work 🎆

@jdantonio
Copy link
Member

Interesting. I'll pull the latest branch and see if it works for me, too. Thanks for keeping at it!

@jdantonio
Copy link
Member

@pitr-ch As far as I can tell your latest update fixed it. On my local machine I rebased this branch onto master (where I merged PR #275) and the tests pass on both JRuby and MRI. I haven't pushed that update yet because I wanted to coordinate with you, first.

I'm comfortable rebasing this PR from master then merging it. That will allow us to work on the other PRs. I also plan to revisit the at_exit handlers for the global thread pools and fix the discrepancy you pointed out a couple of weeks ago.

Are you comfortable with us committing this PR?

@pitr-ch
Copy link
Member Author

pitr-ch commented Apr 20, 2015

Thanks. I'll need to fix few TODOs in the code and verify that all the failing tests are known intermittently failing tests. After that, I'll merge it.

@jdantonio please review #272 first, I've already touched the at_exit handlers there.

@pitr-ch pitr-ch force-pushed the synchronization branch 2 times, most recently from 3fa45c8 to e5fb607 Compare April 20, 2015 13:40
pitr-ch pushed a commit that referenced this pull request Apr 20, 2015
@pitr-ch pitr-ch merged commit f9cf17f into master Apr 20, 2015
@jdantonio
Copy link
Member

@pitr-ch Can we delete this branch?

@jdantonio jdantonio mentioned this pull request Apr 21, 2015
@pitr-ch pitr-ch deleted the synchronization branch April 21, 2015 06:58
@pitr-ch
Copy link
Member Author

pitr-ch commented Apr 21, 2015

@jdantonio done

@jdantonio
Copy link
Member

Thank you!

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

Successfully merging this pull request may close these issues.

2 participants