jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jrafanie has joined #jruby
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
_whitelogger has joined #jruby
drbobbeaty has quit [Write error: Connection reset by peer]
drbobbeaty has joined #jruby
victori_ has quit [Quit: ZNC 1.7.2 - https://znc.in]
victori has joined #jruby
victori has quit [Quit: ZNC 1.7.2 - https://znc.in]
victori has joined #jruby
olleolleolle has joined #jruby
olleolleolle has quit [Quit: olleolleolle]
olleolleolle has joined #jruby
olleolleolle has quit [Quit: olleolleolle]
olleolleolle has joined #jruby
pietia has joined #jruby
olleolleolle has quit [Quit: olleolleolle]
_whitelogger has joined #jruby
pietia has quit [Quit: This computer has gone to sleep]
pietia has joined #jruby
pietia has quit [Client Quit]
_whitelogger has joined #jruby
drbobbeaty has quit [Ping timeout: 240 seconds]
drbobbeaty has joined #jruby
_whitelogger has joined #jruby
_whitelogger has joined #jruby
pietia has joined #jruby
pietia has quit [Client Quit]
_whitelogger has joined #jruby
jrafanie has joined #jruby
shellac has joined #jruby
shellac has quit [Quit: Computer has gone to sleep.]
pietia has joined #jruby
pietia has quit [Quit: This computer has gone to sleep]
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
lucasb has joined #jruby
jrafanie has joined #jruby
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
jrafanie has joined #jruby
jrafanie has quit [Read error: Connection reset by peer]
jrafanie has joined #jruby
xardion has quit [Remote host closed the connection]
xardion has joined #jruby
shellac has joined #jruby
olleolleolle has joined #jruby
olleolleolle has quit [Quit: olleolleolle]
shellac has quit [Quit: Computer has gone to sleep.]
olleolleolle has joined #jruby
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
pietia has joined #jruby
jrafanie has joined #jruby
pietia has quit [Quit: This computer has gone to sleep]
shellac has joined #jruby
jrafanie has quit [Quit: My MacBook has gone to sleep. ZZZzzz…]
shellac has quit [Quit: Computer has gone to sleep.]
<headius[m]> lopex: interesting
<lopex> headius[m]: the discord one also works
<lopex> from t2bot.io
<headius[m]> ahh well I wonder how well that scales but it's certainly an option
<lopex> havent tried telefram
<headius[m]> I hope it batches them somehow
<lopex> well, I guess you can self host any of those
<lopex> headius[m]: it reminds me jabber smtp transports
<lopex> that mail one especially
<headius[m]> ah yeah I suppose
shellac has joined #jruby
<headius[m]> olleolleolle: trying to reproduce your issue now
<headius[m]> 9.2.6.0 seems to be hanging on some INT signal spec?
<headius[m]> I do have the ArgumentError in hand though
<headius[m]> hmm interesting it doesn't seem to error run alone
<olleolleolle> headius[m]: I began disabling the 2 specs which had issues running on JRuby - INT, TERM signal-related.
<headius[m]> hmm we can look into that too after this
<headius[m]> I'm trying to figure out a small reproduction
<olleolleolle> (Sorry, I now understand you got ahead, further into the thing.)
<headius[m]> it calls the lambda ok and then the error is wrong
<headius[m]> so it's not the call to the lambda breaking
<olleolleolle> I kind of believe (after fiddling with adding more output to the RSpec rspec-mock code) that it’s some part of the RSpec verification code which trips the issue.
<headius[m]> I have a theory
<olleolleolle> * https://gist.github.com/olleolleolle/87d4f9591c6319daa80fbe62014bb332 Method: IO#write it says, there)
<headius[m]> ooo
<olleolleolle> And, earlier, there’s a backtrace, which has abort_with_message - abort - puts - write - (RSpec instrumentation code)
<headius[m]> looking at that line
<headius[m]> hmm
shellac has quit [Quit: Computer has gone to sleep.]
<headius[m]> ah-ha
<headius[m]> AH-HA
<headius[m]> maybe
shellac has joined #jruby
<headius[m]> # // In MRI this is used for all multi-arg puts calls to write. Here, we just do it for two
<headius[m]> if (write.retrieveCache(maybeIO.getMetaClass()).method.getArity() == Arity.ONE_ARGUMENT) {
<headius[m]> that's supposed to be Java code
<headius[m]> but it seems like we are trying to detect if the target write method is arity 1, and if it is we break up the argument list into multiple separate calls
<headius[m]> that check could be defeated by some method wrapping we sometimes do, or by bad logic in figuring out the method's arity, or...by mocks that do weird things
shellac has quit [Quit: Computer has gone to sleep.]
<headius[m]> I'm willing to be this is it...happened just over a year ago with the 2.5 work for 9.2
<olleolleolle> Sounds very reasonable!
<headius[m]> in MRI they don't have much variability in how they represent methods and arity, so it probably always works fine for them
<headius[m]> for us we're probably getting a mocked method that says it takes any number of args, and then it actually doesn't
<headius[m]> they shouldn't be using a mock write that doesn't take multiple args
<olleolleolle> …which trips up the RSpec instrumentation verifier
<headius[m]> right
<olleolleolle> “they”, is that rspec-mock?
<headius[m]> because it's in the middle of handling the exception you expected
<headius[m]> and then it blows up with something else
<headius[m]> yeah "they"
<olleolleolle> ty
<headius[m]> this is still a theory but I'm betting I can fake this now
<olleolleolle> Thanks for taking an interest in this anomaly. (I’ve put JRuby in quite a few CI setups, never to have them fail productively, like this.)
<headius[m]> yeah this is an interesting one
<headius[m]> they expanded write to take multiple args and introduced this hack to avoid calling older code that still only takes one
<headius[m]> the hack doesn't appear to be 100% effective in JRuby
<headius[m]> yeah those INT specs really mess some stuff up
<headius[m]> I'm betting that's the reason I see it just terminate sometimes
<headius[m]> uh-huh...pretty sure that's it
<headius[m]> When it fails, the method it's trying to call there is a org.jruby.internal.runtime.methods.ProcMethod
<headius[m]> When it works it's calling org.jruby.RubyIO$INVOKER$i$write, which is the actual method object for the real IO#write
<headius[m]> So I'm guessing what they do is mock an actual IO method and then when they put it back they're putting back some mutilated proc-ified version of it that doesn't take multiple arguments, and we're not detecting that correctly anymore
<olleolleolle> huh
<headius[m]> yup, and the arity claims to be "Opt" which would mean there's some number of optional arguments
<headius[m]> but then it only takes one
<olleolleolle> https://github.com/gocardless/hutch/pull/326 (I made a PR out of “please no INT or TERM signals”)
<headius[m]> hah, I set a breakpoint for ProcMethod in there and the first hit was "Certificate file '/path/to/nonexistant/file' not found"
<headius[m]> 👍
<headius[m]> ```ruby
<headius[m]> hmm sorta works
<liamwhiteGitter[> works better on gitter
<headius[m]> but that's the culprit there, inside rspec/mocks/method_double.rb
<headius[m]> liamwhite (Gitter): looks like just a bad formatter...it's all black and white with bold keywords
<liamwhiteGitter[> (gitter has first-class support for GFM formatting)
<headius[m]> so that method will appear to have variable arity, but then it calls whatever write method that stuff into it that only takes one arg
<olleolleolle> (The matrix.org link service to the code which quick and fine, I ain’t complaining here from IRC.)
<headius[m]> olleolleolle: nice
<olleolleolle> Good dig!
<olleolleolle> aka investigative journalism in code
<headius[m]> I like when it's not what I expected
<headius[m]> ```c
<headius[m]> if (argc > 1 && rb_obj_method_arity(io, id_write) == 1) {
<headius[m]> ```
<headius[m]> oh sure, C gets colors
<headius[m]> ```c
<headius[m]> do rb_io_write(io, *argv++); while (--argc);
<headius[m]> ```
<headius[m]> seriously just make it three lines
<headius[m]> I have no explanation for why this would work in MRI
<headius[m]> they should detect varargs too
<headius[m]> Removing the check fixes it
<headius[m]> (and doing the individual writes every time)
<olleolleolle> the == Arity.ONE_ARGUMENT check, yeah?
<olleolleolle> Would that DESTROY perf?
<headius[m]> well, only if you are doing multi-arg puts a lot
<headius[m]> it would perform like 2.4 and earlier
<olleolleolle> multi-arg puts is not a big thing in the codebases I’ve been puttering around in
<headius[m]> There's possibly a better hack for JRuby, like only go the varargs route if we can detect it's a "natural" method that couldn't lie about arity
<headius[m]> interesting
<headius[m]> MRI fails the same way
<headius[m]> olleolleolle: you said this test succeeds on MRI 2.5 yeah?
<olleolleolle> oh no, we opened the hellmouth
<headius[m]> o = Class.new { def writeme(a); p a; end; define_method(:write) {|*args| method(:writeme).call(*args)}; }.new; $stderr = o; abort "foo"
<olleolleolle> I said that, yeah.
<olleolleolle> https://travis-ci.org/gocardless/hutch/builds/507203309 here’s a build where jruby-9.2.6.0 is the only fail
<olleolleolle> headius[m]: What a stunner!
<headius[m]> I am confused why the error message changes
<headius[m]> maybe that's an rspec thing
<olleolleolle> note that the rspec error is ArgumentError, too
<headius[m]> the error in the spec output is "Expected 1, got 2."
<olleolleolle> just after the `# OLLE` comment I added
<olleolleolle> “verifier.error_message”
<headius[m]> which gist?
<headius[m]> aha
<headius[m]> the message during specs is from method_signature_verifier
<olleolleolle> Learning more about StrictSignatureVerifier …
<headius[m]> elsif !valid_non_kw_args?
<headius[m]> nice
<olleolleolle> (GitHub searches are perhaps better than my expectation, when the search terms are unique enough.)
<headius[m]> VerifyingMethodDouble
<olleolleolle> Link to VerifyingMethodDouble (for ease of following this later)
<headius[m]> so what it seems like is that the mocking logic tries to verify that the signature of the original method matches the signature of the mock method, or something, and it blows up
<headius[m]> removing that code may not have fixed it
<headius[m]> there's some ordering issue that it's messing up IO#write
<headius[m]> olleolleolle: do you have any specs that might be triggering rspec to mock $stderr?
<headius[m]> like specs that check for warnings or something
<olleolleolle> I am looking for SystemExit
<olleolleolle> abort raises that
<olleolleolle> Could _that_ be forcing stderr to be mock?
<olleolleolle> mocké
shellac has joined #jruby
<headius[m]> I don't think so
<headius[m]> but rspec may always mock stderr for something I don't know about
_whitelogger has joined #jruby
<headius[m]> If you could figure out what causes it to start failing that would be helpful
<headius[m]> it passes sometimes
<headius[m]> I'm thinking some spec causes it to intercept IO#write, and when it puts it back again something's broken
<headius[m]> olleolleolle: these don't run in parallel right?
<olleolleolle> I don’t think they are
<olleolleolle> now I get what you mean -
<olleolleolle> (my bedtime beckons; I had fun, keep posting thoughts about this, it’s awesome)
olleolleolle has quit [Quit: olleolleolle]
<headius[m]> I'll see what I can do
<headius[m]> probably will have to drop this soon until Monday
<headius[m]> ttfn
shellac has quit [Quit: Computer has gone to sleep.]
<headius[m]> yep
<headius[m]> so it puts it back using define_method which screws up #parameters
<headius[m]> I should have this fixed in a jiffy
shellac has joined #jruby
<headius[m]> omh
<headius[m]> omg
<headius[m]> yep this is deep
<headius[m]> we have a way to encode the parameter description for a method as a string
<headius[m]> it turns out that native methods (like IO#write) were encoding that string incorrectly
<headius[m]> so while IO#write would say arity = -1 (any number of args), it would report parameter count as single anonymous required argument
<headius[m]> which gets rendered as :req in the #parameters list
<headius[m]> it was a bug in encoding
<headius[m]> that led to the eventual arity check thinking IO#write had a single argument when it's supposed to be variable
<headius[m]> oy vey
<headius[m]> I need to rewrite the binding logic for core methods
<headius[m]> Olle Jonsson (Gitter): so the bug I thought was a bug is just a weird side effect of that hack in MRI, and they do the same thing we would do for the given proxy method
<headius[m]> the actual culprit was that IO#write was incorrectly reporting parameters, which messed up the arity-checking when it went to uninstall the proxy method (which it does for whatever reason)
bga57 has quit [Quit: Leaving.]
bga57 has joined #jruby
shellac has quit [Quit: Computer has gone to sleep.]
<headius[m]> Olle Jonsson (Gitter): fixed as https://github.com/jruby/jruby/issues/5664