Uploaded image for project: 'MariaDB Connector/C'
  1. MariaDB Connector/C
  2. CONC-591

C connector ignoring SIGPIPE

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Minor
    • Resolution: Unresolved
    • None
    • None
    • None
    • None
    • Debian Unstable
      libmariadb from Debian package, version 10.6.7-3+b1

    Description

      Hi,

      I have encountered an issue where a perl script which uses the MariaDB C connector (via DBD::MariaDB or DBD::mysql) ends up ignoring SIGPIPE. This results in problems such as:

      • continuing to run even when the pipeline is broken
      • printing an error on exit

      I am pretty sure that I tracked this down to code in the C connector introduced in this commit:
      https://github.com/mariadb-corporation/mariadb-connector-c/commit/1cefbbecb929b4b4a67b0ac23058ab0167e1c6d6#diff-478b1bbb2170532b687be58bd28e9850ccc0b9a6aec137eb8fff7b8e6d1107bbR3460

      A backtrace seems to confirm this (note the ignore_sigpipe() at #4):

      (gdb) bt
      #0  0x00007ffff7cab9f2 in __GI___libc_sigaction (sig=sig@entry=13, act=act@entry=0x7fffffffd950, 
          oact=oact@entry=0x7fffffffd9f0) at ../sysdeps/unix/sysv/linux/sigaction.c:58
      #1  0x00007ffff7cabb25 in __GI___sigaction (sig=sig@entry=13, act=act@entry=0x7fffffffd950, oact=oact@entry=0x7fffffffd9f0)
          at ../nptl/sigaction.c:30
      #2  0x00007ffff7cab6e5 in __bsd_signal (sig=sig@entry=13, handler=handler@entry=0x1) at ../sysdeps/posix/signal.c:45
      #3  0x00007ffff7cab73b in __bsd_signal (sig=sig@entry=13, handler=handler@entry=0x1) at ../sysdeps/posix/signal.c:35
      #4  0x00007ffff78ca025 in ignore_sigpipe () at ./libmariadb/libmariadb/mariadb_lib.c:3842
      #5  mysql_once_init () at ./libmariadb/libmariadb/mariadb_lib.c:3898
      #6  mysql_once_init () at ./libmariadb/libmariadb/mariadb_lib.c:3851
      #7  0x00007ffff7e5b610 in __pthread_once_slow (once_control=0x7ffff78f7b6c <init_once>, 
          init_routine=0x7ffff78c9fb0 <mysql_once_init>) at pthread_once.c:116
      #8  0x00007ffff7904f1d in ?? () from /usr/lib/x86_64-linux-gnu/perl5/5.34/auto/DBD/MariaDB/MariaDB.so
      #9  0x00007ffff7907f2c in ?? () from /usr/lib/x86_64-linux-gnu/perl5/5.34/auto/DBD/MariaDB/MariaDB.so
      #10 0x00007ffff7901ef0 in ?? () from /usr/lib/x86_64-linux-gnu/perl5/5.34/auto/DBD/MariaDB/MariaDB.so
      #11 0x0000555555667877 in Perl_pp_entersub ()
      #12 0x000055555565df36 in Perl_runops_standard ()
      #13 0x00005555555c1f9d in Perl_call_sv ()
      #14 0x00007ffff79310b9 in XS_DBI_dispatch () from /usr/lib/x86_64-linux-gnu/perl5/5.34/auto/DBI/DBI.so
      #15 0x0000555555667877 in Perl_pp_entersub ()
      #16 0x000055555565df36 in Perl_runops_standard ()
      #17 0x00005555555ca36c in perl_run ()
      #18 0x000055555559d4c2 in main ()
      

      I filed a bug with DBD::MariaDB first, but word there is that the C connector should not be ignoring SIGPIPE.
      https://github.com/perl5-dbi/DBD-MariaDB/issues/170

      It seems like this behavior must exist for an intended purpose, but I don't know what that would be. Even if there is a good reason to ignore SIGPIPE, it does have some undesired consequences.

      Thanks,
      Corey

      Attachments

        Activity

          People

            georg Georg Richter
            bugfood Corey Hickey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Git Integration

                Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.