Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Odin run randomly crashes before running program #4657

Open
lucypero opened this issue Jan 4, 2025 · 10 comments
Open

Odin run randomly crashes before running program #4657

lucypero opened this issue Jan 4, 2025 · 10 comments

Comments

@lucypero
Copy link

lucypero commented Jan 4, 2025

Context

        Odin:    dev-2025-01:fdd3b46c1
        OS:      Windows 11 Professional (version: 23H2), build 22631.4602
        CPU:     AMD Ryzen 7 5800X 8-Core Processor
        RAM:     32694 MiB
        Backend: LLVM 18.1.8

Expected Behavior

To not crash

Current Behavior

odin run randomly crashes, sometimes before even reporting compiler errors

Failure Information (for bugs)

 *  Executing task: odin run . 


 *  The terminal process "C:\WINDOWS\System32\cmd.exe /d /c odin run ." terminated with exit code: -1073741819. 
 *  Terminal will be reused by tasks, press any key to close it. 

 *  Executing task: odin run . 

C:/Users/Lucy/bin/Odin/core/encoding/cbor/coding.odin(407:5) Error: Undeclared name: fmt 
        fmt.println("here")
        ^~^ 

Steps to Reproduce

I can't get it to reproduce reliably. It happens randomly.

@laytan
Copy link
Collaborator

laytan commented Jan 4, 2025

This is not really actionable, as is there is nothing to go on.

Maybe you could provide a stack trace of where it happens, this can be achieved by running the odin run in a debugger.

@lucypero
Copy link
Author

lucypero commented Jan 4, 2025

How would you run odin run in a debugger? I've only debugged executables.

@laytan
Copy link
Collaborator

laytan commented Jan 4, 2025

odin is the executable, if you use build.bat to build it is debuggable, should be able to launch it in the same debugger you use for Odin executables.

You could also provide the code it happens on if it's open source so we can do these things instead.

@Kelimion
Copy link
Member

Kelimion commented Jan 4, 2025

You set odin.exe to be the program to debug, and have the debugger pass run <package> as its arguments.
With RemedyBG it's as easy as remedybg odin.exe run examples\demo.

Even if you can't reliably reproduce it, can you narrow things down some? It would be helpful to know the frequency with which it happens. Did it start recently, or has it also occurred with older Odin versions or on Windows 10?

Is this on small Odin programs, large ones, or is there's no pattern to the things you've tried to compile this happens with?

@Kelimion
Copy link
Member

Kelimion commented Jan 4, 2025

Also, -1073741819 is 0xc0000005, i.e. an access violation. It may very well be that the access violation happens in "foo.exe" and that as a child of odin.exe, that's what it's being attributed to.

* The terminal process "C:\WINDOWS\System32\cmd.exe /d /c odin run ." terminated with exit code: -1073741819.

This says nothing about odin.exe specifically terminating with the access violation, only that the whole cmd.exe, its child odin.exe, and its child did. Which means the culprit could be cmd.exe, odin.exe, or most probably: whatever was just compiled and run.

@lucypero
Copy link
Author

lucypero commented Jan 4, 2025

Thanks. I'll try to get to the bottom of this but it may be hard and take long because it happens very randomly and it's not frequent. I even set up a script to run odin build many many times in a row until it errors out, but i couldn't catch the error there.

Even if you can't reliably reproduce it, can you narrow things down some? It would be helpful to know the frequency with
which it happens. Did it start recently, or has it also occurred with older Odin versions or on Windows 10?

Low frequency. It has been happening for a long time, on other versions of Odin. Only on Windows 11 AFAIK. I've also developed on a Mac but I haven't seen that happen there.

Is this on small Odin programs, large ones, or is there's no pattern to the things you've tried to compile this happens with?

I only remember it happening while working on my NES project.

or most probably: whatever was just compiled and run.

I think we can rule that one out because in the example given, odin run crashed before it even reported a compilation error. Those two task outputs were run back to back without modifying my program, on VS Code.

@Kelimion
Copy link
Member

Kelimion commented Jan 4, 2025

One thing you could also do is to add -show-debug-messages to your build task. If the crash happens in Odin, you'll see output of those messages cut off before mentioning linking foo.exe and removing of temp files. That would possibly narrow down where in Odin it might've happened.

@Kelimion
Copy link
Member

Kelimion commented Jan 4, 2025

I think we can rule that one out because in the example given, odin run crashed before it even reported a compilation error. Those two task outputs were run back to back without modifying my program, on VS Code.

That's self-contradictory? If it crashes before reporting the compilation error, it can't have reported the compilation error.

By necessity the crash must've happened after sending that to stderr. This might be cmd.exe sending its message of misery to stdout, followed by what remained in stderr. They probably do this to aid in finding what caused said misery.

@lucypero
Copy link
Author

lucypero commented Jan 4, 2025

The output shown is of 2 separate task invocations. The first one crashed before outputting the compilation errors.

@Kelimion
Copy link
Member

Kelimion commented Jan 4, 2025

Ah, you're right. So the first time it crashed, while the second time it gave a compilation error. Sorry, I'm tired. I missed the second odin run in that output. :-)

In any event, I think your best bet might be -show-debug-messages and see where it cuts off when you hit this bug next.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants