Puffball has quit [Remote host closed the connection]
_whitelogger has joined #jruby
havenwood has joined #jruby
havenwood has quit [Quit: ZNC 1.7.2 - https://znc.in]
havenwood has joined #jruby
havenwood has quit [Changing host]
lost_and_need_he has joined #jruby
<lost_and_need_he> hi, is ruboto better on jruby?
lost_and_need_he has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
Puffball has joined #jruby
_whitelogger has joined #jruby
_whitelogger has joined #jruby
Puffball has quit [Ping timeout: 250 seconds]
Puffball_ has joined #jruby
travis-ci has joined #jruby
<travis-ci> jruby/jruby (master:d6232db by kares): The build failed. https://travis-ci.org/jruby/jruby/builds/515029546 [217 min 8 sec]
travis-ci has left #jruby [#jruby]
travis-ci has joined #jruby
<travis-ci> jruby/jruby (master:d6232db by kares): The build failed. https://travis-ci.org/jruby/jruby/builds/515029546 [217 min 2 sec]
travis-ci has left #jruby [#jruby]
rusk has joined #jruby
_whitelogger has joined #jruby
aqd has quit [Remote host closed the connection]
drbobbeaty has joined #jruby
drbobbeaty has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
Caerus has quit [Ping timeout: 244 seconds]
<JulesIvanicGitte> I’ll build it with JDK8
Caerus has joined #jruby
<JulesIvanicGitte> 😅
sidx64_ has joined #jruby
<JulesIvanicGitte> Even the `master` branch of JRuby doesn’t compile
<JulesIvanicGitte> :/
sidx64_ has quit [Ping timeout: 246 seconds]
sidx64 has joined #jruby
drbobbeaty has joined #jruby
sidx64 has quit [Ping timeout: 245 seconds]
sidx64_ has joined #jruby
<kares[m]> Jules Ivanic (Gitter): latest master?
sidx64_ has quit [Read error: Connection reset by peer]
<JulesIvanicGitte> yes
<JulesIvanicGitte> Even the `9.2.6.0` tag doesn’t compile for me 🤔
lucasb has joined #jruby
rperez has joined #jruby
<rperez> Hello!! I have problems with ActiveMailer and jruby, can anyone help me or give any recomendations?
jmalves has joined #jruby
<JulesIvanicGitte> @rperez Can we have more details plz ?
<rperez> Thanks! I have this error: "no constructor for arguments (org.jruby.runtime.Frame,org.jruby.RubyClass,org.jruby.runtime.scopes.DynamicScope2,org.jruby.runtime.backtrace.BacktraceElement) on Java::OrgJrubyRuntime::Binding"
<rperez> with this instruction: UsuarioMailer.bienvenido_email(@user).deliver_later
<rperez> I send an email with mail gem, there isn't problem. I think it is an incompatibility with ActionMailer configuration and Jruby
<JulesIvanicGitte> Do you have a better stacktrace ?
<rperez> yes, this is the complete error:
<JulesIvanicGitte> the problem comes from `binding_of_caller` gem
<JulesIvanicGitte> not Rails
<JulesIvanicGitte> I’m not sure that `binding_of_caller` is compatible with JRuby
<JulesIvanicGitte> it’s implemented in C
<JulesIvanicGitte> it can’t be compatible with JRuby
<JulesIvanicGitte> Solution: remove this gem from your dependencies
<rperez> ok, i don't know the funcionality of these gem
<JulesIvanicGitte> it’s a debugger or something like IIRC
<JulesIvanicGitte> not something you should ship in production
<JulesIvanicGitte> only for developers
<JulesIvanicGitte> you can remove it safely normally
<JulesIvanicGitte> (edited) you can remove it safely normally => IIRC it’s a debugger or something like that
<rperez> ok. Thanks! The project is work correctly with jruby, but only when i have to send an email give the error. .
<rperez> Great!! it is working! Thanks so much @JulesIvanicGitte
jmalves has quit [Remote host closed the connection]
jmalves has joined #jruby
<JulesIvanicGitte> I compiled with the `./mvnw` instead of the `mvn package -Pbootstrap`. Any important difference ?
<JulesIvanicGitte> :tada:
<JulesIvanicGitte> @kares Don’t know why but now it compiles 😅
<JulesIvanicGitte> Cool !
<JulesIvanicGitte> Cheers :)
rperez has quit [Quit: http://www.kiwiirc.com/ - A hand crafted IRC client]
<kares[m]> that's good!
<kares[m]> no difference really - mvnw is more of a convenience (and to have min required maven, maybe)
<kares[m]> also using system mvn for all JRuby related tasks
<JulesIvanicGitte> I built a docker image containing the @headius `fiber_enumerator_next ` branch:
<JulesIvanicGitte> The `ruby -S` mechanism describe here : https://github.com/jruby/jruby/blob/master/BUILDING.md#running-jruby is awesome !
<JulesIvanicGitte> so easy to launch my app with my local JRuby build :)
<JulesIvanicGitte> (edited) so easy to launch my app with my local JRuby build :) => The `ruby -S` mechanism described here : https://github.com/jruby/jruby/blob/master/BUILDING.md#running-jruby is awesome !
<JulesIvanicGitte> (edited) The `ruby -S` ... => The `jruby -S` ...
<JulesIvanicGitte> @headius Sadly, I don’t see any difference with you branch in its current state: https://www.dropbox.com/s/jxnz8jcducuwguf/Screenshot%202019-04-03%2016.56.24.png?dl=0
<JulesIvanicGitte> :/
<JulesIvanicGitte> (edited) >1400 threads ... => \> 1400 threads ...
<JulesIvanicGitte> :/
<JulesIvanicGitte> etc. etc. etc.
<kares[m]> you can start selling that with an enterprise license per core!
<JulesIvanicGitte> ahha
<JulesIvanicGitte> I’m RIIIIIICH
<JulesIvanicGitte> :dollar: :dollar: :dollar: :dollar:
<kares[m]> most def! :)
<kares[m]> only one step left ...
<JulesIvanicGitte> @keres About your comment here: https://github.com/jruby/jruby/pull/5672/files#r271287063
<JulesIvanicGitte> it’s a bug ?
<JulesIvanicGitte> I should replace `next_p` by `next` ?
<kares[m]> Jules Ivanic (Gitter): yy
<kares[m]> but that should only get used with JI
<kares[m]> when an Enumerator is used as a java Iterator
<JulesIvanicGitte> humm I’m not sure to be able to understand you :/
<JulesIvanicGitte> Is it normal that thread launched to back the fibers are deamonized ?
<JulesIvanicGitte> (edited) ... that thread launched ... => ... that the threads launched ...
<kares[m]> well if you aren't using JRuby's java scripting capabilities than do not worry about i
<kares[m]> t
<kares[m]> yes its normal
<kares[m]> actually all Ruby threads are daemon Java threads
<JulesIvanicGitte> why deamons ?
<kares[m]> not sure ... there's likely a reason
<JulesIvanicGitte> seems not important in fact
<kares[m]> believe Ruby threads are daemon so that the JVM does not exit when there's any left
<kares[m]> actually the other way around -> when the Ruby main thread exits the JVM should exit
<kares[m]> exits -> finishes
rusk has quit [Remote host closed the connection]
<JulesIvanicGitte> > actually the other way around -> when the Ruby main thread exits the JVM should exit
<JulesIvanicGitte> Yes :)
xardion has quit [Remote host closed the connection]
<JulesIvanicGitte> I’m a total newbie but why do you boot a thread per fiber ? It doesn’t seems to be the definitions of fibers
<JulesIvanicGitte> Why not just have lightweight fibers running on a pool of threads dedicated to handle these fibers ?
<JulesIvanicGitte> (edited) ... lightweight fibers running ... => ... lightweight fiber implementation running ...
<JulesIvanicGitte> It’ll move my thread leak to a memory garbage collect problem
<JulesIvanicGitte> (edited) It’ll move ... => It’d move ...
<JulesIvanicGitte> (edited) ... leak to ... => ... leak problem to ...
<JulesIvanicGitte> (edited) ... garbage collect problem => ... garbage collection problem
<JulesIvanicGitte> (edited) It’d move my thread leak problem to a memory garbage collection problem => I’m a total newbie but why do you boot a thread per fiber ? It doesn’t seems to be the definition of fibers
<JulesIvanicGitte> Some Scala projects implemented fibers lately: https://github.com/scalaz/scalaz-zio
<JulesIvanicGitte> (edited) ... fibers lately: https://github.com/scalaz/scalaz-zio => ... fibers lately. This one for example: https://github.com/scalaz/scalaz-zio
<JulesIvanicGitte> this one also: https://github.com/monix/monix
<JulesIvanicGitte> These 2 projects are 2 different implementation of the IO monad
<kares[m]> its not really worth it that much
<kares[m]> there used to be a fiber thread pool ... maybe its still around
<kares[m]> but using it did not make much sense
<kares[m]> (in terms of improving performance)
<JulesIvanicGitte> but he’s unbounded
<JulesIvanicGitte> Ok I have to correct my previous question:
<JulesIvanicGitte> Why not just have lightweight fiber implementation running on a BOUNDED pool of threads dedicated to handle these fibers ?
<kares[m]> if there's a parked thread it will be used
<JulesIvanicGitte> (edited) ... - https://github.com/monix/monix => ... - https://github.com/monix/monix
<kares[m]> lighweight? well we would need support from the JVM
<JulesIvanicGitte> could be lightweight
<kares[m]> not sure what you mean ... LW means not backed by a thread?
<JulesIvanicGitte> yes
<JulesIvanicGitte> just a simple instance of a class
<kares[m]> to correct myself ... I was testing bounded pool (in JRuby 1.7) and it did not make a difference
<kares[m]> but you need to switch execution context and pop back
<kares[m]> how do you want to do that light-weightly?
<JulesIvanicGitte> I really don’t know how to implement Fibers. I don’t know this subject so I can really tell.
<JulesIvanicGitte> How I understand it for now is that Fibers are logical threads
<kares[m]> its possible in a compiled language -> kotlin does it
<JulesIvanicGitte> because they’re just a simple object they can be GCed
<kares[m]> but you need to know ahead of time which parts (functions/methods) will be fiber-ish
<kares[m]> fibers are gc-d just fine
<kares[m]> the threads end up being re-used
<JulesIvanicGitte> not in my case sadly :/
<kares[m]> that likely means you have a leak somewhere ...
<kares[m]> sometimes its hard to resolve without having all of the code at hand
<kares[m]> well at least for me - guessing from thread/heap dumps :)
<headius[m]> Oh sorry I have unpushed fixes
<JulesIvanicGitte> 😅
<headius[m]> I was fixing in the car on the way to my halfway vacay
<JulesIvanicGitte> Driving and coding, you have to choose :D
<JulesIvanicGitte> (I think you have to be French to understand the joke 😅)
rperez has joined #jruby
<headius[m]> haha
<headius[m]> I get it
<JulesIvanicGitte> :)
<headius[m]> did you run into something that hit that bug?
<headius[m]> it should only affect when passing an Enumerator to Java as an Iterator
<JulesIvanicGitte> No I didn't
<headius[m]> ok
<headius[m]> well I pushed fixes for it anyway...almost mergeable
<headius[m]> I see there's some questions about why we implement fibers this way
<headius[m]> the main problem here is that at least one library you're running, biz, creates these enumerators, starts them up, and then just walks away from them
rperez has quit [Client Quit]
<headius[m]> in CRuby's case they can do that because they swap the entire fiber off the thread and use the same thread to execute other stuff
<headius[m]> we can't do that because JVM has no such capability, so every fiber has its own thread and if you walk away from it it's still there holding a thread
<headius[m]> The coroutines in Kotlin and Scala are done using bytecode tricks and static typing...every function that needs to be pauseable and resumable in a coroutine has to be generated with special bytecode that doesn't actually deepen the call stack
<headius[m]> kares pretty much covered the reasons why we can't do what they do
<headius[m]> the next interesting project in this area would be to use openjdk project loom for our fibers
<JulesIvanicGitte> Hum. Super interesting :)
<JulesIvanicGitte> Thanks for taking the time to explain all this!
<JulesIvanicGitte> > the next interesting project in this area would be to use openjdk project loom for our fibers
<JulesIvanicGitte> Yup totally agree
<headius[m]> Jules Ivanic (Gitter): so I gathered from skimming messages that the branch did not appear to help your situation
<headius[m]> I've pushed last fixes I know of
<JulesIvanicGitte> No it doesn’t help.
<JulesIvanicGitte> Maybe that you pushed eveything, it’ll. Don’t know. I have to rebuild a JRuby version and test but I’m on something else right now.
<JulesIvanicGitte> We’re also exploring the “biz” side of the problem
<headius[m]> I doubt these fixes will change anything
<JulesIvanicGitte> maybe there’s a bug in the “biz” gem
<headius[m]> it's possible they could do something in a more lightweight way but my reading of that library is that they heavily lean on enumerator-as-fiber
<headius[m]> I can't imagine it's very efficient in CRuby either
<headius[m]> but it wouldn't use up too many threads
<headius[m]> hmmm
<headius[m]> to_a does consume the whole contents normally
<headius[m]> is this where the leaking enumerators in question get started up?
<JulesIvanicGitte> I can’t show you the `to_biz` function code but it more or less only creates a `Biz::Schedule`
<JulesIvanicGitte> > is this where the leaking enumerators in question get started up?
<JulesIvanicGitte> Yes sir
<headius[m]> ahh I know why it doesn't
<headius[m]> hmm maybe
<JulesIvanicGitte> OH ?
<headius[m]> well it's definitely not a typical enumerator because it uses a block rather than a real collection
<headius[m]> so if that block isn't terminating after the logical last item that would keep it alive
<headius[m]> like if I did this to an Enumerator.new { |y| loop { y.yield 1 } } it would never complete
<JulesIvanicGitte> One of my developers was very intrigued by the biz `until` implementation
<headius[m]> loop { e = Enumerator.new {|y| [1,2,3].each {|i| y.yield i}}; e.to_a }
<headius[m]> that does not leak
<headius[m]> loop { e = Enumerator.new {|y| [1,2,3].each {|i| y.yield i}}; e.lazyto_a }
<headius[m]> oops
<JulesIvanicGitte> Are you able to do a PR in the
<headius[m]> Jules Ivanic (Gitter): are you able to reproduce the leaking outside of your app?
<headius[m]> like with a simple script calling biz
<JulesIvanicGitte> > are you able to reproduce the leaking outside of your app?
<headius[m]> that would be a big help
<JulesIvanicGitte> Didn’t try
<JulesIvanicGitte> hum good idea
<headius[m]> ok that would be really helpful
<headius[m]> if we can come up with specific cases leading to those leaking threads we can mitigate it, or if there's a bug we can fix that
<headius[m]> I have another possible theory that if these enumerators really are left hanging, it might be possible to .rewind to reset them and free the thread
<headius[m]> sort of like an enum.abort
<headius[m]> rewind may save us for these scoped cases that only want partial enumerator results
<headius[m]> Jules Ivanic (Gitter): can you post your biz config somewhere?
<JulesIvanicGitte> > ok that would be really helpful
<JulesIvanicGitte> I’m asking to one of my dev if he can help us. Not sure he’ll accept. It’s 8pm here :/
<JulesIvanicGitte> Huhu we’re lucky
<JulesIvanicGitte> he’ll write the script
lucasb has quit [Quit: Connection closed for inactivity]
<JulesIvanicGitte> He’s finishing eating
<JulesIvanicGitte> (edited) ... finishing eating => ... finishing to eat
<JulesIvanicGitte> > can you post your biz config somewhere?
<JulesIvanicGitte> Which configuration ?
<headius[m]> well when I played with biz the first thing it needed was a config
<headius[m]> like what work hours are etc
<JulesIvanicGitte> my engineer also gave me a proof that the leak effectively occurs with this script: https://www.dropbox.com/s/6ciulrw7nw4c4tz/image.png?dl=0
<JulesIvanicGitte> :)
<headius[m]> excellent!
<headius[m]> There are still some issues on the branch so I don't think that patch will make 9.2.7
<headius[m]> it's a lateral move anyway
<JulesIvanicGitte> In the worst case, if it don't go in 9.2.7, we now know how to build a custom Jruby version :)
<headius[m]> yeah I'm going to run this against master and see what it looks like internally
<headius[m]> ok so this example appers to hit week_periods from biz
<headius[m]> ok yeah
<headius[m]> so they are effectively infinite generators
<JulesIvanicGitte> interesting!
<headius[m]> #<Enumerator: #<Biz::Timeline::Forward:0x55fe41ea @periods=#<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator: #<Enumerator::Generator:0x1ce24091>:each>>:map>:reject>:flat_map>:reject>>:until(2019-04-18 13:55:06 -0500)>
<headius[m]> each iteration creates that
<JulesIvanicGitte> > <Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy: #<Enumerator::Lazy
<JulesIvanicGitte> 🤔
<JulesIvanicGitte> because of `:each>>:map>:reject>:flat_map>:reject>>:until` ?
<JulesIvanicGitte> ok
<headius[m]> yeah that's what it amounts to internally as it stacks each level of transformation
<headius[m]> so it has this infinite generator, multiple levels of lazy on top to filter and alter results, and then finally a terminating condition of some kind
<headius[m]> I'm trying to sort out how far to_a gets...and whether it's supposed to be rewinding something
sidx64 has joined #jruby
<headius[m]> yikes
<headius[m]> yeah this library is the heaviest use of enumerators, generators, and lazy I've seen
<headius[m]> ok I think I'm starting to sort out where the issue is
<headius[m]> it's largely this "periods" enum they use in linear.rb
<headius[m]> in this case that's week_periods
<headius[m]> that appears to be the primary place where they end up doing #next, and then those periods enums are left hanging
<headius[m]> so the to_a does drain the Linear enumerator, but it flat_maps against this other enumerator and never shuts it down
<JulesIvanicGitte> ok
<headius[m]> so many layers
<JulesIvanicGitte> omg yes :/
<JulesIvanicGitte> each one will boot a thread ?
<headius[m]> ok so I misspoke a bit there
<headius[m]> each layer of a lazy enumerator does create one of these anonymous block-based enumerators that cause us trouble
<headius[m]> BUT
<headius[m]> if you only use that lazy with .each or other normal internal iteration methods, it will be fine
<headius[m]> the outer one, the one you get from Linear, does get run this way
<headius[m]> but it is constructed with two other enumerators, "periods" and "shifts", and it only pulls a few items from each during its run
<headius[m]> so I think the "fix" or workaround would be to get the outer enumerator to know about those inner ones so you can reset the whole thing at once
<headius[m]> I'm trying to get it to propagate a rewind call all the way in
drbobbeaty has quit [Quit: My MacBook Pro has gone to sleep. ZZZzzz…]
sidx64 has quit [Ping timeout: 246 seconds]
yaauie has joined #jruby
<yaauie> What can I do to accelerate someone helping me get started with the Open3 issue I filed a few weeks ago (https://github.com/jruby/jruby/issues/5642#)? It's blocking Logstash installs on Java 11 and preventing our test suite from validating behaviour. I'm glad to do the brunt of the work, but need pointers with someone more familiar with JRuby core.
<JulesIvanicGitte> @yaauie sorry to ask but why don’t you stay on JDK8 ?
<yaauie> Java 8 has reached end-of-life and is no longer providing security-related updates. Our customers and community are wanting to run on supported JDKs
<JulesIvanicGitte> untrue
<JulesIvanicGitte> AdoptOpenJDK continue to support JDK8
<JulesIvanicGitte> I strongly advise you to use their builds
nirvdrum has quit [Ping timeout: 245 seconds]
<JulesIvanicGitte> The official OpenJDK8 build aren’t up to date
<JulesIvanicGitte> The latest version is u202 while OpenJDK only provides u181
<JulesIvanicGitte> Some important fixes made in JDK10 about its integration with Docker where backported in JDK8u191
<JulesIvanicGitte> (edited) Some important fixes made in JDK10 about its integration with Docker where backported in JDK8u191 => The official OpenJDK8 builds aren’t up to date
nirvdrum has joined #jruby
<JulesIvanicGitte> (edited) The official OpenJDK8 builds aren’t up to date => Some important fixes made in JDK10 about its integration with Docker were backported in JDK8u191
<yaauie> Arguments about forks and distributions of the JDK aside, I need to support Oracle JDK11 and OpenJDK11, and am hitting bugs with the Open3 implementation while doing so.
<JulesIvanicGitte> can’t help on this side. Sorry.
rperez has joined #jruby
rperez has quit [Client Quit]
<headius[m]> yaauie: hi there
<headius[m]> yaauie: if that was your reason for moving to 9+ then you really don't need to
<headius[m]> there are many companies other than Oracle providing 8 builds with security updates, usually with lower or no cost
<headius[m]> we will get 9 working well for these things but short term workaround for you could be to use 8
<headius[m]> I do follow that you need to support 11
<headius[m]> and I want to help :-)
<headius[m]> it's just a really busy time right now before RubyKaigi and RailsConf
<headius[m]> kares: I wonder if you have some cycles to help yaauie look into this Java 9+ Open3.popen2 hanging?
<headius[m]> Jules Ivanic (Gitter): Ok so I have spent the time on this I can for now
<headius[m]> I'm going to update the issue with everything I know and we should get the Biz folks involved
<headius[m]> I think we can make Biz behave better if it cleans up after itself when these lazy enumerators complete
<headius[m]> just a minimal amount of cleanup
<headius[m]> that's what I can give you today
<headius[m]> I'd say we take your small example and start a conversation with Biz folks about what we can do to improve how it cleans up these temporary enumerators
<headius[m]> yaauie: so
<yaauie> @headius I saw your replies on the ticket. Thanks much for following up and getting it kicked off. We're currently pointing our users to the Java 8 workaround for installation failures on Debian, and looking at ways we can route around the problem in the short-term by spawning the sub-processes ourselves without Open3's convenience.
<headius[m]> yaauie: ^
<headius[m]> so if we use pure native pipe descriptors it seems to work fine
<headius[m]> I propose a likely root cause there along with a patch to do just that
<headius[m]> we have not used pure native IO.pipe up to now because most IO were still just using normal JDK channels...but for subprocess stuff, if we can't unwrap those channels we can't properly interact with the native process calls like posix_spawn
<JulesIvanicGitte> @headius Thanks ! :)
<headius[m]> yaauie: JRuby patch and Ruby workaround provided
<headius[m]> we'll have to discuss the right path forward
<headius[m]> sorry I didn't get time to look into this...these things are often only 15 minute deals for me (since I wrote 90% of this stuff) but as I mentioned it's been a busy month 😓
<headius[m]> And now, I'm going swimming.
<headius[m]> bbl
mistergibson has joined #jruby