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

Make ffi calls interruptible #27

Open
k-bx opened this issue Mar 23, 2017 · 6 comments
Open

Make ffi calls interruptible #27

k-bx opened this issue Mar 23, 2017 · 6 comments

Comments

@k-bx
Copy link
Contributor

k-bx commented Mar 23, 2017

GHC 7.8 brought interruptible FFI. This might be very useful sometimes, especially upon hanging request through FFI. Some more context on a reddit thread.

What do you think? Would that be a good thing to have? Should mysql support GHC >=7.8 or would adding such thing require doing ifdefs to support older GHCs as well? Thanks.

@qrilka
Copy link

qrilka commented Mar 23, 2017

If I understand it correctly custom SIGPIPE handler is needed - https://dev.mysql.com/doc/refman/5.7/en/c-api-threaded-clients.html

@3noch
Copy link

3noch commented Mar 23, 2017

Don't safe FFI calls also allow interruption? I'm pretty sure that's already happening here.

@qrilka
Copy link

qrilka commented Mar 23, 2017

@3noch Austin Seipp talks about it explicitly in the post linked above

@3noch
Copy link

3noch commented Mar 23, 2017

@qrilka I see. Right now I think the C code is just blocking RTS signals: https://github.com/paul-rouse/mysql/blob/master/cbits/mysql_signals.c#L28-L32

@qrilka
Copy link

qrilka commented Mar 29, 2017

@3noch but only SIGALRM and SIGVTALRM are blocked.
MySQL docs say:

To use your own SIGPIPE handler, first call mysql_library_init(),
then install your handler.

I have tried unblocking SIGPIPE before doing a test query but the signal doesn't get through.

@paul-rouse could we know your opinion on this issue?

@paul-rouse
Copy link
Owner

Sorry, I'm not ignoring this, but I have a work deadline - I'll give it proper thought soon!

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

4 participants