JRuby

Generator sometimes hangs up

Details

  • Type: Bug Bug
  • Status: Closed Closed
  • Priority: Major Major
  • Resolution: Fixed
  • Affects Version/s: JRuby 1.1b1
  • Fix Version/s: JRuby 1.0.3, JRuby 1.1RC2
  • Component/s: Core Classes/Modules
  • Labels:
    None
  • Environment:
    Mac OS X 10.4, MacBook, Core Duo, 2GB RAM
  • Number of attachments :
    1

Description

The Generator seems to have problems with big enumerations:

$ time jruby -rgenerator -e 'gen = Generator.new((0..100000)); gen.next while gen.next?'
real 0m5.699s
$ time jruby -rgenerator -e 'gen = Generator.new((0..100000)); gen.next while gen.next?'
^C
real 3m9.880s

It seems the bigger the number is, the more often jruby hangs up (process goes to sleep.)

This also affects the bm_loop_generator benchmark from Ruby 1.9.

Since the problem doesn't arise always, I can't think of a test case yet.

Activity

Hide
Charles Oliver Nutter added a comment -

On channel mele said this seemed to be ok in 1.0.x, but that may just be because it doesn't compile and doesn't run as fast. I'd imagine there's just a threading deadlock somewhere in the generator code. Fix for 1.1 and 1.0.3.

Show
Charles Oliver Nutter added a comment - On channel mele said this seemed to be ok in 1.0.x, but that may just be because it doesn't compile and doesn't run as fast. I'd imagine there's just a threading deadlock somewhere in the generator code. Fix for 1.1 and 1.0.3.
Hide
Peter Brant added a comment -

Fix attached.

It turns out the problem was that the generator could fail to notice that the thread supplying data had finished.

I'm not really sure how to test for this. Any thoughts?

Show
Peter Brant added a comment - Fix attached. It turns out the problem was that the generator could fail to notice that the thread supplying data had finished. I'm not really sure how to test for this. Any thoughts?
Hide
Vladimir Sizikov added a comment -

Ah, this problem has been fixed when JRUBY-1640 was fixed. Basically, the same root cause, different manifestations.

And the patches are very close too.

I guess this issue can be safely closed now.

Show
Vladimir Sizikov added a comment - Ah, this problem has been fixed when JRUBY-1640 was fixed. Basically, the same root cause, different manifestations. And the patches are very close too. I guess this issue can be safely closed now.
Hide
Ola Bini added a comment -

This is resolved on trunk. Also, other test cases catch this one too.

Show
Ola Bini added a comment - This is resolved on trunk. Also, other test cases catch this one too.

People

Vote (0)
Watch (3)

Dates

  • Created:
    Updated:
    Resolved: