Closed dehubbed closed 9 years ago
You have a undelivered promise deref inside the mutex block; if I comment it out your snippet will work for me, anyway looking deeper into it in order to better understand the exception you get.
The deref is there to create an artificial blocking situation. Of course it works if you take it out, then the second lock attempt will happen after the first has been released only.
Yes, the exception happens even with a limited Fiber/sleep 2000 ms.
Can you try with 0.6.3-SNAPSHOT? You'll need to clone and lein install
manually.
Give me 2hrs.
Works well, thanks for the quick fix. Looks like it was an instrumentation issue after all, albeit a clojure internal one of sorts. May I ask how you found out? The -Dco.paralleluniverse.fibers.verifyInstrumentation=true switch didn't produce any output for me.
Good, glad it works for you too. I could spot it in the report about uninstrumented frames indeed, but only after I included the Fiber/sleep
call. Instrumentation verification is performed by fibers. Any (potentially) fiber-blocking call should do.
Thanks I'm not getting this report in spite of the system property being set and a warning at startup that verification may harm performance. I assume the 'report' is some dump on the console? I'll keep an eye out, it seems to be essential for quasar/pulsar work.
Yes it's a stack dump and it usually comes before strange exceptions like this one. It marks with an "*" the stack frames that miss instrumentation and it's quite visible. But if there's no fiber-blocking call on the stack the verification has no chances to be performed, so in case of missing instrumentation of "internal" runtime methods that are not blocking per-se (but can call blocking methods), like this one, the verification will be performed only when another suspendable method is being called. It shouldn't affect normal user code though, as "user" methods will be declared suspendable because they can suspend in their body (or because they call other suspendable methods which can, in turn, suspend).
Ok I had the Fiber/sleep which is a blocking call and didn't get this stack trace. Also the deref on the promise is normally a fiber blocking call too, and should do the same IMHO. Anyways probably not worth pursuing this now that the problem is fixed. Thanks again.
True about the deref, it should end up calling a fiber-blocking function on a Quasar promise. I'll think a bit more about it and I'll consider opening a Quasar issue to investigate this further if I don't come to any further understanding.
When the second fiber in this example tries to lock the lock, there is a NullPointerException.
yields:
Turning on verifiyInstrumentation doesn't show anything and anyways I don't think it's an instrumentation problem. The line of code that NPE's curiously can't throw an NPE in theory:
I traced it in the debugger and
blocker
is not null, not that it would matter. Must be something at the byte code level that's screwy.