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

Should we set `CLIENT_IGNORE_SIGPIPE` for MySQL? #643

Closed
sgrif opened this Issue Feb 8, 2017 · 6 comments

Comments

Projects
None yet
1 participant
@sgrif
Member

sgrif commented Feb 8, 2017

One of the flags to mysql_real_connect is CLIENT_IGNORE_SIGPIPE, which is documented as

Prevents the client library from installing a SIGPIPE signal handler. This can be used to avoid conflicts with a handler that the application has already installed.

We should probably answer the following questions:

  • What does the signal handler that libmysqlclient is installing actually do? Is it even doing anything that is useful for applications using Diesel?
  • How common will it be for applications using MySQL with Diesel to install their own handlers?
  • Can we detect if a handler has already been installed?
    • If yes, do we expect normal usage to install the handler before establishing a database connection?
@sgrif

This comment has been minimized.

Member

sgrif commented Feb 8, 2017

Unless I'm misreading the source, libmysqlclient will always install signal(SIGPIPE, SIG_IGN), and the CLIENT_IGNORE_SIGPIPE flag doesn't appear anywhere in the codebase other than in the definition.

@sgrif

This comment has been minimized.

Member

sgrif commented Feb 8, 2017

Going to git log -SCLIENT_IGNORE_SIGPIPE. This will take a while.

@sgrif

This comment has been minimized.

Member

sgrif commented Feb 8, 2017

This setting appears to be completely useless and broken since mysql/mysql-server@ebd2462 (or earlier, but that was the last time it was referenced in libmysqlclient). MySQL will always clobber any handlers installed for SIGPIPE, and we can do nothing about it other than writing a direct wire protocol implementation

@sgrif sgrif closed this Feb 8, 2017

@sgrif

This comment has been minimized.

Member

sgrif commented Feb 8, 2017

I mean... Now that I think about it, it makes complete sense. Of course you wouldn't define "should we set this signal handler" as a connection option. It's a global thing. They should still update the docs and remove the define though.

@sgrif

This comment has been minimized.

Member

sgrif commented Feb 8, 2017

Also they should probably not clobber global signal handlers

@sgrif

This comment has been minimized.

Member

sgrif commented Feb 8, 2017

Just saying

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment