Debugging type level bugs
Aug. 29th, 2020 12:04 pmI don't know, do people really use debuggers for real code?
https://github.com/oracle/helidon/blob/355f646492e6529734a5b1a2aa50422bf8c75a5a/common/reactive/src/main/java/io/helidon/common/reactive/MultiFlatMapPublisher.java#L198-L235 - the bug here, to my mind, is best described as a type-level bug.
Not a variable of the wrong type, more like part of the computation has the wrong type.
I am not sure how a debugger can help, even if one can find a way to coax the code go through the problematic code path. (But first one would need to realize it is problematic, right?..)
The only assurance you can have, is a formal proof. The next best thing is code review.
https://github.com/oracle/helidon/blob/355f646492e6529734a5b1a2aa50422bf8c75a5a/common/reactive/src/main/java/io/helidon/common/reactive/MultiFlatMapPublisher.java#L198-L235 - the bug here, to my mind, is best described as a type-level bug.
Not a variable of the wrong type, more like part of the computation has the wrong type.
I am not sure how a debugger can help, even if one can find a way to coax the code go through the problematic code path. (But first one would need to realize it is problematic, right?..)
The only assurance you can have, is a formal proof. The next best thing is code review.
no subject
Date: 2020-08-29 03:12 pm (UTC)Using Scala might have helped them, but well... Seems like since people just don't know much about functors, they know even less about monads.
And the code is barbaric. Debug or not, how would one test it. Hopeless.
no subject
Date: 2020-08-29 05:06 pm (UTC)The code is horrible. But even the (reactive) spec (by this guy and a few Akka guys) has a few bugs. I attribute it to the lack of education.
no subject
Date: 2020-08-29 07:56 pm (UTC)Well, lack of education is a sad fact of life. Another problem with it is that you can't explain to them anything.
no subject
Date: 2020-08-29 09:14 pm (UTC)- I have a proof there are the following issues ...
- Do you have a reproducer?
:)
no subject
Date: 2020-08-29 09:57 pm (UTC)It was a non-constructive proof.
no subject
Date: 2020-08-29 10:21 pm (UTC)Actually, I did line them up, through tedious modification of the code - literally suspend threads reaching certain lines, and resume in a particular order. But I found it funny that the demand is to get "a reproducer". It's not like "if you run with these inputs, you always hit the issue". It is more like "if you yell at your hard disks hard enough, you will get this sometimes".
no subject
Date: 2020-08-29 10:39 pm (UTC)I see. Maybe it's hard to convince the management that it's important. A couple of weeks ago I created a case named "race condition in..." - and then they wanted me to prove it is one. I did not care, I just wanted to walk around and provide a solution (retry).
Then they wanted me to "investigate and reproduce". Refactoring not allowed, so I can't seriously even test the huge method. So I said, ok. Then another guy decided to tweak that method, to "make it better". For some reason, he was allowed to do it. Did not help. Now it's called "race condition".
If it were like 10 years ago, I would have been totally pissed off. Now I just smile at those guys (like dr. Freud, kind of). Who cares, actually.
no subject
Date: 2020-08-30 12:09 pm (UTC)no subject
Date: 2020-08-30 02:10 pm (UTC):) Yes, it's all psychology and hormones. (And some "negative" experience.)