| |
 | Posted by Timon Gehr in reply to Walter Bright | Permalink Reply |
|
Timon Gehr 
Posted in reply to Walter Bright
| On 5/4/25 07:00, Walter Bright wrote:
> On 5/3/2025 8:48 PM, Timon Gehr wrote:
>> This is not only the case in C. Translate the example to D and compile with LDC with optimizations enabled. You will most likely see zero segfaults.
>
> I replied to that in the other post.
> ...
You replied by moving the goalposts and denying reality.
>
>> On an somewhat related note: in D you can currently create invalid non-null pointers in `@safe` code by exploiting the lack of checks.
>
> D relies on the null dereference not being "optimized away". Maybe there's a switch for that on ldc, there should be if there isn't one.
> ...
This is not how modern backends work. There are good reasons why you can't do a segfault in e.g. Rust without exploiting type system bugs.
>
>> All I am seeing is that sometimes user's programs close and they are not giving me any further information because they don't really know how to use a computer and it happens infrequently enough that they don't care enough to try to figure out how to help me out. This may be a null dereference, or it could be something else. Maybe it even prints a stack trace on Windows, but the console window closes on them immediately or something. Who knows what actually is happening. I am not seeing this on my machine...
>
> Such can be pretty tough to figure out. It could be a bug in your code, it could be a codegen bug, it could a bug in the library, etc. Maybe try sending them an unoptimized build? maybe add a signal handler that writes the diagnostic information to a file before exiting?
> ...
They cannot use an unoptimized build, it's too slow. This is not a patient programmer, this is a normie user, and the issue is vastly less important to them than it is to me, because I have higher standards of my software working flawlessly than normie users do.
>
>> I can probably try to set up some other way to debug that then gets flagged as malware even harder. However, none of this is necessary in the first place. If my `scope(exit)` ran they would be able to immediately provide all the info I need, as was the case with a couple thrown Exceptions and Errors in the past.
>
> I thought you wrote that scope(exit) was catching null pointer exceptions.
> ...
I don't think it does.
>
>> Well congrats, seems your bugs were reproducible on your own machine and at a frequency of more than once every couple of months.
>
> I've also had to remotely debug buildkite failures. I've done it by adding strategic printfs to generate a log of the path through the compiler.
> ...
Seems you ran the program multiple times and got the same failure. Please understand this is exactly what I am trying to achieve by saving the pertinent information in `scope(exit)` so it can be sent to me, in order for me to be able to hopefully reproduce the issue.
> I've also done things by trying out the problem on another operating system, or different codegen switches. This can give helpful information. Anything you can do to vary the environment to see what might trigger it.
> ...
Sure. But this is not a batch program, this is a graphical application that communicates over the network.
>> I don't even know if the crashes are my fault or not. Maybe they even happen in some dependency, which I would know if D's error handling was more useful.
>
> I find the stack trace useful enough.
> ...
I am not getting any stack trace. The only info I get is "the program closed randomly on me". And anyway, if I have the choice between a cryptic stack trace and a full execution history leading to the error, I will choose the full execution history every time. Why is this so hard to understand? The language taking control away from me is nothing but frustrating, for imagined benefits that are pure dogma and not important to me at all.
I will perhaps be able to find some workaround that will allow me to get some info, but this issue existing in the first place is not something that is necessary. It is pure, frustrating, friction. A huge amount of wasted time that could have been spent doing something productive instead. A competitive disadvantage.
>
>> AFAIU the default druntime ships with `-release`.
>
> See the -checkaction= switch?
> ...
I think that won't affect the default druntime, I would need to build a custom one. I can do this but it complicates the build instructions for other people and it really feels like fighting the language.
>
>> It's not useless for everything, it's just useless for some things. Your anecdotes are unfortunately not universal and also things changed.
>
> It only has to work on platforms D supports, not every computer ever made.
LLVM bytecode is a supported platform. In fact, it is likely the primary IR D user's released programs will go through and it's not like this is defined behavior in GDC. This cannot be dismissed with a "C is crazy". We are using toolchains designed for C.
> ...
>
>>> P.P.S. `scope(failure)` is not intended for catching `Error`, although it does. There's a PR to fix it to only catch `Exception`, but that failed in the test suite.
>>
>> This is heart-shattering news. If this ever gets pulled without any option to revert I will no longer be able to justify using the official D releases for anything.
>
> I had no idea anyone was using it for that purpose. I guess I can't change that :-)
>
The whole: "We really need to make sure people cannot get any information out of a failing process unless they run the program from the command line and then we need to make sure nothing but a stack trace will escape unless we are running in a debugger" is simply not workable. I don't understand what you are chasing in this instance, but it is not utility. It almost seems like your only experience with remote crashes is those that happen frequently and repeatably, and within a terminal.
|