<lopex> headius[m]: to keep your attention, most of https://github.com/jruby/jruby/issues/5576 is just stdlib right ?
<lopex> unicode is already on 12 on master fyi
<headius[m]> Yeah, we should be getting close to having all the basic features done. That branch has standard library merged in already, so remaining failures would be core features that aren't quite done yet.
<headius[m]> There wasn't a ton of stuff in 2.6
<headius[m]> I'm focusing on getting this loaded features code working exactly as in MRI and then I'll start doing some refactoring and optimization. Hopefully by Monday we will have all require and load and auto load issues resolved
<lopex> so the outstanding is String#split with block for core from I gather
<lopex> but ppl will not use it for years
<headius[m]> Yeah, we are usually pretty conservative about finishing up new features, since people won't upgrade jruby right away, and won't be using those new features for a while
<headius[m]> Our version number claim refers more to the standard library
<lopex> headius[m]: the new proc methods are hard or not ?
<lopex> I guess the compose could be really optimized on IR level right ?
travis-ci has joined #jruby
<travis-ci> jruby/jruby (master:c811789 by Benoit Daloze): The build was canceled. https://travis-ci.org/jruby/jruby/builds/512745819 [214 min 53 sec]
travis-ci has left #jruby [#jruby]
<headius[m]> Indy ought to be able to optimize those just fine if we thread it through to the block
<lopex> seems hard in ruby
<lopex> like a compose b
<lopex> do a and b still have to maintain uppper scope envs ?
<lopex> since any of those can capture anything
<lopex> headius[m]:
<lopex> right ?
<lopex> so it all boils down to elimination
<lopex> actually js faces the same problem
victori has quit [Quit: ZNC 1.7.2 - https://znc.in]
victori has joined #jruby
<headius[m]> Well, within a controlled scope, we can tell The binding isn't being used elsewhere. In that case we can optimize at as if it's just a method call
subbu|away is now known as subbu
mengu has joined #jruby
sidx64 has joined #jruby
mengu has quit [Remote host closed the connection]
mengu has joined #jruby
mengu has quit [Ping timeout: 255 seconds]
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
sidx64 has joined #jruby
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_whitelogger has joined #jruby
mengu has joined #jruby
mengu has quit [Read error: Connection timed out]
mengu has joined #jruby
sidx64 has joined #jruby
sidx64 has quit [Client Quit]
sidx64 has joined #jruby
claudiuinberlin has joined #jruby
claudiuinberlin has quit [Quit: Textual IRC Client: www.textualapp.com]
claudiuinberlin has joined #jruby
mengu has quit [Remote host closed the connection]
mengu has joined #jruby
mengu has quit [Ping timeout: 246 seconds]
travis-ci has joined #jruby
<travis-ci> jruby/jruby (master:c811789 by Benoit Daloze): The build was fixed. https://travis-ci.org/jruby/jruby/builds/512745819 [220 min 57 sec]
travis-ci has left #jruby [#jruby]
mengu has joined #jruby
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
travis-ci has joined #jruby
<travis-ci> jruby/jruby (master:705834d by Charles Oliver Nutter): The build has errored. https://travis-ci.org/jruby/jruby/builds/512969031 [221 min 27 sec]
travis-ci has left #jruby [#jruby]
mengu has quit [Read error: Connection reset by peer]
mengu_ has joined #jruby
lucasb has joined #jruby
<JulesIvanicGitte> I have a thread leak in my app, I’ll not have the time today to do what you asked @headius. Sorry :/
<headius[m]> Oh well good luck
claudiuinberlin has joined #jruby
shellac has joined #jruby
<JulesIvanicGitte> @headius do you have advices to find the source of my thread leak ?
<JulesIvanicGitte> The leaking threads are call “Ruby-0-Fiber-<a number>”.
<JulesIvanicGitte> I don’t really know how to debug that :/
<JulesIvanicGitte> :/
sidx64 has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
xardion has quit [Remote host closed the connection]
xardion has joined #jruby
mengu_ has quit [Quit: Leaving...]
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<headius[m]> You using a lot of fibers or a library that does?
<headius[m]> seeing many fiber threads does not necessarily indicate a leak, but if there never going away then there's a bug in the fiber logic somehow. Or possibly a bug in code that's using fibers causing them to never got of scope
<JulesIvanicGitte> > You using a lot of fibers
<JulesIvanicGitte> We don’t use any. I think it’s a lib that uses them
<headius[m]> Looks like that particular fiber is running something for activesupport "each_without_time_with_zone" extension to Range
<headius[m]> How may if these do you have alive right now?
<headius[m]> It will spin up as many as needed but they should get reused generally and should go away when finished
<JulesIvanicGitte> it seems (but I still have to validate) that it’s this gem the problem : https://github.com/zendesk/biz
<headius[m]> First step would be determining if there are actually fiber objects still alive (or really, Enumerator objects used with #next). If there being kept alive somehow, this is not unexpected...each Enumerator doing #next would hold a thread
<headius[m]> They're
<headius[m]> That would certainly cause such a Enumerator thread to happen, yes
<headius[m]> The example you're showed is definitely coming out of active support though
<JulesIvanicGitte> ok
<JulesIvanicGitte> But, with debugging I see that the `biz` gem creates fibers
<JulesIvanicGitte> Here’s one fiber created by `biz` which is still alive after the request handling is done:
<JulesIvanicGitte> No active record mention here
<headius[m]> Are there many threads with small traces of just a few lines? I'm curious if a bunch spun up but are not in active use
<headius[m]> Might be easier if you could zip up the whole thread dump and post it
<headius[m]> We do have various tests confirming that old you numerator and fibers do go away, so there's no bug I know of
<headius[m]> Enumerator not "you numerator"
<JulesIvanicGitte> I sent you the thread dump in Gitter private message
<JulesIvanicGitte> (edited) ... Gitter private message => ... Gitter private/direct message
<CharlesOliverNut> ok
<headius[m]> 230 threads doesn't seem unreasonable if there's a lot of enumerators or fibers in flight
<JulesIvanicGitte> The thread dump I sent you is just the local debug I did
<JulesIvanicGitte> In production, I have >1400 threads
<JulesIvanicGitte> and when that number is reached, the app crashed
<JulesIvanicGitte> (edited) ... app crashed => ... app crashes
<headius[m]> ok
<JulesIvanicGitte> Here’s a screeshot showing the problem : https://www.dropbox.com/s/c06koded8cltacr/Screenshot%202019-03-29%2016.13.33.png?dl=0
<headius[m]> 194 of these appear to be that activesupport Range extension
<headius[m]> out of 230
<JulesIvanicGitte> wow
<JulesIvanicGitte> it’s a lot
<headius[m]> yeah either that's a weird implementation or something is keeping those enumerators alive
<headius[m]> heap dump time
<headius[m]> ah thanks was just looking for that
<JulesIvanicGitte> Maybe I can monkey patch the `each_with_time_with_zone`
<JulesIvanicGitte> (edited) ... the `each_with_time_with_zone` => ... the `each_with_time_with_zone` method
<JulesIvanicGitte> with a noop
<JulesIvanicGitte> and look what’s happening ?
<JulesIvanicGitte> I don’t understand what it doing
<headius[m]> hmm..this doesn't have the def of each_without_time_with_zone which seems to be where they are creating these enumerators
<JulesIvanicGitte> you’re right
<headius[m]> ugh
<headius[m]> there is no definition in all of 4-2-stable so this must be some magic
<headius[m]> interesting
<JulesIvanicGitte> yes
<JulesIvanicGitte> it’s my conclusion too
<headius[m]> damn that alias_method_chain
<headius[m]> ok so each_without_time_with_zone is just the new name for the old Range#each
<JulesIvanicGitte> how to you know that ? I don’t understand 🤔
<JulesIvanicGitte> oh ok
<JulesIvanicGitte> I just understood
<JulesIvanicGitte> I should admit that I absolutly don’t understand the link between this `alias_method_chain` and my thread leak
<headius[m]> well this code is not directly the issue
<JulesIvanicGitte> is it just because Range#each use an enumerator behing ?
<headius[m]> somewhere an enumerator is getting made to do this each_with_zone whatever and those enumerators are not going away
<headius[m]> hmmm
<JulesIvanicGitte> hmmmm
<headius[m]> you know your biz link may actually be part of this
<headius[m]> Jules Ivanic (Gitter): These all seem to be interpreted...are you running locally with --dev or something?
<headius[m]> a new thread dump with -Xjit.threshold=0 (and no --dev obviously) would be helpful, and then I think the heap dump is next
<JulesIvanicGitte> I’m running locally
<JulesIvanicGitte> the thread dump I sent you was generated while I was debugging with RubyMine
<headius[m]> right I'm asking if you have --dev flag or something else preventing us from compiling code
<JulesIvanicGitte> > a new thread dump with -Xjit.threshold=0 (and no --dev obviously) would be helpful, and then I think the heap dump is next
<JulesIvanicGitte> Ok I do that
<headius[m]> because your earlier thread trace had jitted code lines in it so I could see the source
<headius[m]> I really just want to see one of these rangeEach traces but with the Ruby parts compiled
<headius[m]> heh I suppose the one you posted first is that
<headius[m]> yeah don't worry about it for now, but -J-Djruby.compile.mode=OFF is the flag preventing JIT
<JulesIvanicGitte> `-J-Djruby.compile.mode=OFF` could be the culprit
<JulesIvanicGitte> `-J-Djruby.compile.mode=OFF` could be the culprit
<headius[m]> that should not be necessary any more for debugging, but I'm not sure if they're doing something else weird
<headius[m]> the link I posted above is where the fibers are coming from
<JulesIvanicGitte> ok
<JulesIvanicGitte> thanks
<headius[m]> this is inherited code...a pure-Ruby impl of flat_map that needs to use an enumerator like this
<headius[m]> so there's a couple things at play here
<headius[m]> if you have an enumerator in hand, it won't have a thread until you start calling "next" on it, even with this Yielder stuff
<headius[m]> once it has the thread, I think that thread stays alive for as long as the Enumerator is alive, or until you completely drain all elements with #next
<headius[m]> so the likely cause of this is that there's a bunch of enumerators sitting around that have started "nexting" but never stopped, and never got dereferenced
<headius[m]> we can't tell who's holding on to them without the heap dump though
<JulesIvanicGitte> I’ll generate a new thread dump and a new heap dump
<JulesIvanicGitte> do you still want me to use the `-Xjit.threshold=0` flag ?
<headius[m]> I'll take a look at the impl of lazy in CRuby to see if they've got logic that doesn't need external iteration like this
<headius[m]> yeah please do
claudiuinberlin has joined #jruby
<JulesIvanicGitte> ok
<headius[m]> or set it to something suitably low...we obviously have hundreds of threads hitting this code, so it should jit
<JulesIvanicGitte> I don’t know what you consider suitably low :/
shellac has quit [Ping timeout: 246 seconds]
<headius[m]> the lazy impl in MRI is still largely the same
<headius[m]> what's a little worrisome about this is that the Ruby version we have is creating another one for every level of lazy stuff, it seems
<headius[m]> they do as well
<headius[m]> so you get this chain of threads each feeding results up the line
<headius[m]> yeah GC's definitely running but these aren't getting cleared out
<JulesIvanicGitte> @headius I sent you the new thread dump and related heap dump via Gitter private message
<headius[m]> thanks, downloading now
<JulesIvanicGitte> :)
<headius[m]> So the good news is that your thread dump does appear to mostly just be one level of lazy flat_map
<headius[m]> if there were more levels getting stacked on it we'd see more variety in the thread dumps
<JulesIvanicGitte> ok
<JulesIvanicGitte> How can I help you ?
<headius[m]> hmm
<headius[m]> well if you can figure out who is calling each_with_time_with_zone that would be a start
<headius[m]> I wonder if we can update these thread names on the fly to indicate who is calling it
rusk has quit [Remote host closed the connection]
<headius[m]> or what thread initiated it
<JulesIvanicGitte> > I wonder if we can update these thread names on the fly to indicate who is calling it
<JulesIvanicGitte> Could be a good idea. Is it possible ?
subbu is now known as subbu|away
<JulesIvanicGitte> > well if you can figure out who is calling each_with_time_with_zone that would be a start
<JulesIvanicGitte> With the Rubymine debug mode, it should be easy
<JulesIvanicGitte> `”stack frame is unavailable”` in the Rubymine debug mode :/
<headius[m]> hmm
<JulesIvanicGitte> is there some magic in the JRuby runtime which can generate the stack frame ?
<JulesIvanicGitte> because my break point is inside `each_with_time_with_zone` method
<JulesIvanicGitte> (edited) ... is inside ... => ... is currently inside ...
<JulesIvanicGitte> I can evaluate some code
<JulesIvanicGitte> `Thread.current.backtrace.join("\n”)` ??
<headius[m]> "Linear?
<headius[m]> does that sound familiar?
<headius[m]> that's one of the classes that's holding onto one of these enumerators
<JulesIvanicGitte> yes!
<JulesIvanicGitte> it’s also what I see
<headius[m]> ahh here we go
<JulesIvanicGitte> I have a break point on the biz code: `Linear.new …` I sent you
<headius[m]> Biz::Periods::Linear
<headius[m]> yeah
<headius[m]> seems like it's coming back around
<JulesIvanicGitte> and I have a break point inside `each_with_time_with_zone`
<JulesIvanicGitte> when I hit `Linear.new`, the next breakpoint I hit is the one inside
<JulesIvanicGitte> (edited) ... inside => ... inside `each_with_time_with_zone `
<JulesIvanicGitte> they’re related
<headius[m]> the thread name can be updated
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<headius[m]> yup ok
<headius[m]> so
<headius[m]> this instance of Linear I have in hand has a long tail
<JulesIvanicGitte> In my dependencies, I also have a `enumerable-lazy` gem ...
<JulesIvanicGitte> this class to be exact
<JulesIvanicGitte> don’t know if it interectact with the rest
<headius[m]> looks familiar
<JulesIvanicGitte> there’s a `flat_map` implementation: https://github.com/yhara/enumerable-lazy/blob/v0.0.2/lib/enumerable/lazy.rb#L130
<headius[m]> nearly the same as what we ship
<headius[m]> so this may or may not actually be lowing
<JulesIvanicGitte> I put some break points in the enumerable-lazy class
<JulesIvanicGitte> they’re not hitted
<headius[m]> yeah ok
<JulesIvanicGitte> all these threads are blocked inside `each_with_time_with_zone `: https://www.dropbox.com/s/sxavz1xo0q501wg/Screenshot%202019-03-29%2019.05.58.png?dl=0
<JulesIvanicGitte> > jruby/jruby#5670
<JulesIvanicGitte> +1
<JulesIvanicGitte> I suscribed :)
<headius[m]> ok so at least we know it's a fairly localized issue!
<headius[m]> gonna need to come up with a better impl of these lazy methods to try to get rid of the fiber usage, but that's a separate project
<headius[m]> the issue here is that they're being held in memory
<JulesIvanicGitte> In the screenshot I sent you we can see the “self” being a “Biz:Week"
<JulesIvanicGitte> (edited) ... a “Biz:Week" => ... a `Biz:Week`
<headius[m]> they might have just gone away otherwise and you wouldn't notice
<headius[m]> ok
<headius[m]> makes sense since this is calendar-related
<headius[m]> what's that github project again? I can't find it
<headius[m]> oh zendesk
MattPattersonGit has joined #jruby
<MattPattersonGit> I was wondering if there's a canonical way to wrap java iterators when you need to return a wrapper instance around the values returned by the iterator: ```def each
<MattPattersonGit> <some java iterator>.each do |value|
<MattPattersonGit> yield(MyWrapper.wrap(value))
<MattPattersonGit> end
<MattPattersonGit> ```
<MattPattersonGit> ooops
<headius[m]> hmm
<headius[m]> nothing comes to mind...that seems fairly idiomatic
<headius[m]> are they being wrapped for some special reason?
<enebo> map()?
claudiuinberlin has joined #jruby
<MattPattersonGit> I'm writing a Ruby wrapper around a Java library
<enebo> I guess if yo do not want a result
<headius[m]> Jules Ivanic (Gitter): yeah so that link you originally sent with the yielder...that's our man
<MattPattersonGit> and need to wrap the underlying java instances returned by this iterator in the appropriate Ruby wrapper class
<headius[m]> that is a delegator holding a reference to this top-level Enumerator.new { } thingy
<JulesIvanicGitte> @headius which link ?
<JulesIvanicGitte> yes :/
<JulesIvanicGitte> do you have an idea how to fix that ? I don’t understand the code.
<headius[m]> well
<headius[m]> there's no bug in here per se
<JulesIvanicGitte> what is the `yielder` thing ?
<MattPattersonGit> the iterator may be an infinite sequence, so I want to wrap it lazily, but there seem to be some problems with just sticking a lazy enumerator on it (https://github.com/jruby/jruby/issues/4212)
<headius[m]> ok so a bit of impl detail here
<headius[m]> enumeration in Ruby is all done internally, by passing a block into the enumerable object and it yields back the values
<headius[m]> because Ruby is based on internal iteration, getting Enumerator#next to work means you have to be able to do that block pass and pause it after each item
<headius[m]> for a normal Enumerator we do this internally using a fiber OR a non-threaded non-fiber version if we know it's e.g. walking a simple array with a simple index
<headius[m]> (if we know it's a normal array and hasn't been messed with we can just walk it externally without a block + yield)
<headius[m]> This code is basically the uber-generic way to do it
<headius[m]> ...same as the code in our Lazy impl
<headius[m]> it's basically creating an enumerator where #next is going to be fed by this block + yielder, so that's where the internal iteration part is
<headius[m]> there's no easy way for us to see through this code to do a non-threaded version, so it's always threaded if you #next
<headius[m]> the Enumerator.new block and the yielder are basically equivalent to what Array#each would do internally
<headius[m]> except this gets run in a thread
<headius[m]> Fibers and Enumerator#next are one of the biggest hassles for alt impls right now
<headius[m]> (I say one of because they're basically the same internally)
<JulesIvanicGitte> Hummmmmm
<JulesIvanicGitte> I think I understand a bit 🤔
<JulesIvanicGitte> I’m sorry @headius I’ll have to go
<JulesIvanicGitte> You can contact me on twitter: `@guizmaii` if you need
<JulesIvanicGitte> Thanks again for your help :)
<JulesIvanicGitte> I’ll not be available until next wednesday to work on this subject sadly :/
<CharlesOliverNut> matrix is not sending my last messages
<JulesIvanicGitte> > Did you open a bug for this?
<JulesIvanicGitte> No I didn't
<JulesIvanicGitte> I do that and I then I’ll have to go
<CharlesOliverNut> ok great, thank you
<CharlesOliverNut> I'm trying to sort out using Eclipse MAT why these objects are alive
<headius[m]> If you could do that quick for me I'd appreciate it
<JulesIvanicGitte> a minimal one
<JulesIvanicGitte> do you want more info ?
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<CharlesOliverNut> that's fine
<CharlesOliverNut> than kyou
<JulesIvanicGitte> Thank you! :à
<JulesIvanicGitte> (edited) ... you! :à => ... you! :)
<JulesIvanicGitte> Have a nice weekend
<JulesIvanicGitte> Bye :)
<CharlesOliverNut> ttfn!
claudiuinberlin has joined #jruby
_whitelogger has joined #jruby
Byron42 has joined #jruby
<MattPattersonGit> @headius so, basically the `peek` running twice thing isn't a showstopper unless you have some hairy side effects in whatever ruby needs to be evaluated to return the next item
<MattPattersonGit> cool
<MattPattersonGit> I can just use `Enumerator::Lazy` and worry about caching the wrapped objects another day
<MattPattersonGit> (that is the `Lazy` way)
<MattPattersonGit> thanks!
<CharlesOliverNut> I forget if I mentioned but yeah, that's a known issue with some of our coroutine-like logic...but I think it works properly with Fiber and it should be better once we make Enumerator#next use Fiber
<CharlesOliverNut> The issue @guizmaii brought to us today might force the issue
<MattPattersonGit> I think the main thing I still don't entirely understand is whether I can just use JRuby's `Enumerable`-over-`java.Iterator` stuff as the core of the lazy enumerator that does the wrapping, or I should be using the Java Iterator API directly there
<MattPattersonGit> but that's a my-understanding problem, not an actual problem
<Byron42> Anybody have any pointers or suggestions on troubleshooting something like this
<CharlesOliverNut> @fidothe Shouldn't be a problem either way...the Enumerable logic just walks the Iterator.hasNext/next for you
subbu|away is now known as subbu
lucasb has quit [Quit: Connection closed for inactivity]
yaauie has joined #jruby
<yaauie> I'm attempting to get JRuby source compiling locally so I can take a stab at the Open3 vs Java 9+ issue I filed a couple weeks ago, and am getting a flood of "error: constructor XXX in class XXX cannot be applied to given types" messages when invoking `./mvnw` on a fresh checkout on `master` or on the tagged release for `9.2.6.0`. Has anyone encountered this before?
<yaauie> I'm running Oracle Java 1.8.0_152
<yaauie> Although the same occurs with both Oracle JDK 11 and Open JDK 11.
<yaauie> and after another `./mvn clean` the issue went away. I may have had cached bits from my first attempt when JVM 11 was selected.
<CharlesOliverNut> yaauie: does your nickname meansomething?
<CharlesOliverNut> and hello!
<CharlesOliverNut> Yeah compiling on newer JDK usually breaks on older one even if we compile with older bytecode
<CharlesOliverNut> they add signatures and methods resolve to the newer versions sometimes
<CharlesOliverNut> we could force that by always compiling against the Java 8 runtime libraries but then we couldn't conditionally incude Java 9 code
<CharlesOliverNut> ...cannot tell via matrix bridge who is around :frowning:
<headius[m]> testing
<headius[m]> ok good my client's working again
Byron42 has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<yaauie> my screen-name is a slice-and-dice of my legal name, the 2nd and 3rd letters of each.
<yaauie> name.split.map{|n| n[1..2] }.join
<headius[m]> heh ok
<yaauie> do you have any recommendations for setting up my env to test something that fails in Java 9+? any docs on how to run tests on one JVM after building on a supported one?
<headius[m]> oh well there should be docs on the basic test suites...most of us use some sort of JDK switcher to swap between them
<headius[m]> really you just need it in PATH and JAVA_HOME though
<headius[m]> you should be able to build and test JRuby on 9 though
<headius[m]> we just don't release that way for the reason you discovered
claudiuinberlin has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
<yaauie> I'm having a hard time putting together a test case for GH-5642 that doesn't cause the test suite to hang indefinitely when encountering the bug. I've attempted using Timeout, but the only thing that really works is sending `SIGINT`, which propagates to the spawned process and also cancels the rest of the test suite.
<headius[m]> Well, if it's hanging that's a pretty obvious bug 😀
<headius[m]> Sorry we have not gotten to your issue, there's only a few of us doing what we can and it's been a pretty busy month
<headius[m]> What I might recommend would be to try to figure out which cases do work properly, and we can start to sort out the difference between them. I would have expected our native process Management to work okay I'm Java 9. Do you have a thread dump handy? Ctrl+\
<yaauie> I don't, but I'll add one to the ticket this week. We're attempting to support Java 11 with the upcoming release of Logstash 7; (a) our test suite is failing in wonky ways because we use the Open3 library to shell out and (b) pleaserun (which builds service configurations) is hanging on Java 11 for what I suspect are similar reasons.
<yaauie> I'll put together thread dump on monday, just signing off for the week now.
yaauie has quit [Ping timeout: 256 seconds]
<headius[m]> oh hey you're a logly person
<headius[m]> well we love prioritizing things for our big users :-)
<headius[m]> Primary thing to figure out is why the native stuff is not loading, or if it's loading why it's not working (I suspect the former)
<headius[m]> On Windows, there's bigger issues because we've never had full process support there.