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

wrap callback call in try catch #173

Closed
wants to merge 1 commit into from
Closed

wrap callback call in try catch #173

wants to merge 1 commit into from

Conversation

SimonDanisch
Copy link
Member

I remember reading, that errors in c callbacks yield undefined behavior! Since I ran into some undefined behavior with GLFW, I figured that it might be this.
I'm not 100% if that's actually true, so we shouldn't use this try catch if it's false. We should probably also try to give some more information & backtrace.

Sorry to ping you directly, but @yuyichao, you're probably the only one who would know the answer to this question with certainty!

@jayschwa
Copy link
Member

I remember reading, that errors in c callbacks yield undefined behavior!

Do you know where? The default error callback throws an error and has always seemed to work fine.

Since I ran into some undefined behavior with GLFW

Can you provide some more details?

@SimonDanisch
Copy link
Member Author

Hm this is a bit complicated...
So I read that thread in discourse a while ago - and it's not unlikely that I miss-remember the details or got the context wrong! Sadly, I cant find it anymore. Anyways, remember when upgrading to 1.0, I had a bunch of very weird silent corruptions? I never pinned them down, but it looked a lot like undefined behavior in the event callbacks.
I also pinned down some of those to Observables, which I use to propagate the GLFW events - so callbacks I register with Observables, end up being called from within a GLFW callback.
And I got some really weird bugs, were julia just silently quit or froze, which was fixed by introducing a try catch in the Observable callbacks, and printing the error instead of throwing it!
Since I read that discourse thread, I came up with the theory, that the actual source of corruption might have been in throwing inside the c-callback.
Since Julia currently has problems with catching errors this might also have a different cause! That's why I hope someone else could give us some clarity on what could have caused this!

@SimonDanisch
Copy link
Member Author

This hasn't turned up anymore

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

Successfully merging this pull request may close these issues.

2 participants