Page 1 of 107

Venting thread

Posted: Sat Dec 05, 2020 10:19 am
by Ryusenshi
Today, an interesting case of heisenbug: my program works perfectly on my laptop, but when I run it on a distant machine, I get a lot of NaN results... OK, so I add a handful of printf to try to localize the bug. And now the results are fine! So I remove the printf... and the NaNs are back. Unbelievable.

EDIT: hmm, apparently compiling with -O0 resolves the bug. It seems my compiler makes some unsafe optimization, but can't do it with a printf.

Re: Venting thread that is tentatively once again all-inclusive

Posted: Sat Dec 05, 2020 12:30 pm
by Travis B.
Ryusenshi wrote: Sat Dec 05, 2020 10:19 am Today, an interesting case of heisenbug: my program works perfectly on my laptop, but when I run it on a distant machine, I get a lot of NaN results... OK, so I add a handful of printf to try to localize the bug. And now the results are fine! So I remove the printf... and the NaNs are back. Unbelievable.

EDIT: hmm, apparently compiling with -O0 resolves the bug. It seems my compiler makes some unsafe optimization, but can't do it with a printf.
Heisenbugs are always fun. Note that the fact that it works only with -O0 or printf may indicate that your code is actually doing unsafe, which it just happens to be able to get away with under certain conditions.

Re: Venting thread that is tentatively once again all-inclusive

Posted: Sat Dec 05, 2020 12:37 pm
by Travis B.
I had a minor case of the stupids today; I was wondering why my breakpoints weren't catching, when I finally remembered that I was running code on the remote server, while I was setting breakpoints on my local server (I can't set breakpoints on the remote server), so obviously they were not going to catch!

Re: Venting thread that is tentatively once again all-inclusive

Posted: Sat Dec 05, 2020 1:06 pm
by zompist
Travis B. wrote: Sat Dec 05, 2020 12:37 pm I had a minor case of the stupids today; I was wondering why my breakpoints weren't catching, when I finally remembered that I was running code on the remote server, while I was setting breakpoints on my local server (I can't set breakpoints on the remote server), so obviously they were not going to catch!
I feel like I do versions of this all the time. Not breakpoints per se, but getting frustrated because my obviously correct fix isn't working, and then realizing that the fix and the behavior I'm looking at are on different machines.

Re: Venting thread that is tentatively once again all-inclusive

Posted: Sat Dec 05, 2020 9:57 pm
by Man in Space
For the past week or thereabouts I’ve been regularly starting my days well but then developing a 100+ fever and a stuffy nose in the evenings. Now joint pain is in the mix. I’m suspecting flu.

Re: Venting thread that is tentatively once again all-inclusive

Posted: Sat Dec 05, 2020 10:20 pm
by rotting bones
Man in Space wrote: Sat Dec 05, 2020 9:57 pm For the past week or thereabouts I’ve been regularly starting my days well but then developing a 100+ fever and a stuffy nose in the evenings. Now joint pain is in the mix. I’m suspecting flu.
Get well soon.

Re: Venting thread that is tentatively once again all-inclusive

Posted: Sun Dec 06, 2020 4:56 am
by Raphael
Man in Space wrote: Sat Dec 05, 2020 9:57 pm For the past week or thereabouts I’ve been regularly starting my days well but then developing a 100+ fever and a stuffy nose in the evenings. Now joint pain is in the mix. I’m suspecting flu.
Good luck!

Re: Venting thread that is tentatively once again all-inclusive

Posted: Sun Dec 06, 2020 12:10 pm
by Ryusenshi
Problem solved, by passing the result through a variable instead of inserting it into the array directly (which was probably the unsafe step).

Re: Venting thread that is tentatively once again all-inclusive

Posted: Sun Dec 06, 2020 12:16 pm
by Travis B.
Ryusenshi wrote: Sun Dec 06, 2020 12:10 pm Problem solved, by passing the result through a variable instead of inserting it into the array directly (which was probably the unsafe step).
That is odd - I don't see why that'd make a difference unto itself.

Re: Venting thread that is tentatively once again all-inclusive

Posted: Sun Dec 06, 2020 12:51 pm
by Ryusenshi
Travis B. wrote: Sun Dec 06, 2020 12:16 pmI don't see why that'd make a difference unto itself.
This is what I thought about printf in the first place, and yet here we are.

Re: Venting thread that is tentatively once again all-inclusive

Posted: Sun Dec 06, 2020 12:58 pm
by Travis B.
Ryusenshi wrote: Sun Dec 06, 2020 12:51 pm
Travis B. wrote: Sun Dec 06, 2020 12:16 pmI don't see why that'd make a difference unto itself.
This is what I thought about printf in the first place, and yet here we are.
The significance of printf is that it prevents optimizations from taking place by breaking up the code. However I would be hesitant to blame the compiler unless all the other possible causes can be ruled out.

Re: Venting thread that is tentatively once again all-inclusive

Posted: Sun Dec 06, 2020 1:03 pm
by alice
Travis B. wrote: Sun Dec 06, 2020 12:58 pm The significance of printf is that it prevents optimizations from taking place by breaking up the code. However I would be hesitant to blame the compiler unless all the other possible causes can be ruled out.
printf? Real programmers flash the lights on their keyboard in optimised Morse code!

Re: Venting thread that is tentatively once again all-inclusive

Posted: Sun Dec 06, 2020 1:42 pm
by rotting bones
Let's be real. A real programmer can solve any problem in the world by inducing viscous flow in the sweat collected in his own belly button. Source: https://gilkalai.wordpress.com/2014/02/ ... computers/

Re: Venting thread that is tentatively once again all-inclusive

Posted: Sun Dec 06, 2020 1:49 pm
by Travis B.
alice wrote: Sun Dec 06, 2020 1:03 pm
Travis B. wrote: Sun Dec 06, 2020 12:58 pm The significance of printf is that it prevents optimizations from taking place by breaking up the code. However I would be hesitant to blame the compiler unless all the other possible causes can be ruled out.
printf? Real programmers flash the lights on their keyboard in optimised Morse code!
One could limit oneself to blinking LED's on one's board...

but even most MCU's (and we are talking tiny systems here) at least come with a USART which one can hook up to a serial dongle, and thus communicate with with a terminal emulator.

Re: Venting thread that is tentatively once again all-inclusive

Posted: Sun Dec 06, 2020 9:22 pm
by rotting bones
I've been feeling absolutely terrible since yesterday. Today, it's worse. I can't eat or sleep. All I feel is anxiety. I don't think anything is wrong with me. I have to present my final project tomorrow, and I can't concentrate on my work. I even cleared my schedule since Thursday so I'd have lots of time. It didn't work. It wouldn't be so bad if I didn't have to teach two 1.5 hour classes tomorrow as well.

Re: Venting thread that is tentatively once again all-inclusive

Posted: Mon Dec 07, 2020 3:02 am
by Raphael
rotting bones wrote: Sun Dec 06, 2020 9:22 pm I've been feeling absolutely terrible since yesterday. Today, it's worse. I can't eat or sleep. All I feel is anxiety. I don't think anything is wrong with me. I have to present my final project tomorrow, and I can't concentrate on my work. I even cleared my schedule since Thursday so I'd have lots of time. It didn't work. It wouldn't be so bad if I didn't have to teach two 1.5 hour classes tomorrow as well.
I hope this somehow works out and you get better.

Re: Venting thread that is tentatively once again all-inclusive

Posted: Mon Dec 07, 2020 4:44 pm
by Travis B.
I feel utterly stuck on my priority inversion-resistant lock implementation. In a particular test scenario, one task that is holding a number of locks and then releasing them so other tasks can take them is getting descheduled inexplicably; even when I put code in the scheduling and descheduling routines they do not record the task getting descheduled, but when I test the task after the fact it clearly has been descheduled. It's been like a couple weeks now and I have gotten nowhere on this.

Re: Venting thread that is tentatively once again all-inclusive

Posted: Thu Dec 10, 2020 10:08 am
by malloc
Over the past few months, I have gotten several calls saying that I've been charged with some unspecified crime. My family says they are just scams, but they keep coming and I am starting to worry. I cannot think of anything illegal I have done over the past year, apart maybe from voting absentee without a sufficiently compelling reason or making some mistake when filing my income taxes.

Re: Venting thread that is tentatively once again all-inclusive

Posted: Thu Dec 10, 2020 10:54 am
by alice
malloc wrote: Thu Dec 10, 2020 10:08 am Over the past few months, I have gotten several calls saying that I've been charged with some unspecified crime. My family says they are just scams, but they keep coming and I am starting to worry. I cannot think of anything illegal I have done over the past year, apart maybe from voting absentee without a sufficiently compelling reason or making some mistake when filing my income taxes.
Rest assured, these are scam calls. If you really were being charged with something, you would be told what it was, and it's very unlikely you would be told by phone. Is there a person or organisation you can call who deals with nuisance calls?

Re: Venting thread that is tentatively once again all-inclusive

Posted: Thu Dec 10, 2020 11:22 am
by Raphael
Could it be someone who knows malloc, knows about his anxiety issues, and is playing a cruel prank on him?