EnterpriseDB / mysql_fdw

PostgreSQL foreign data wrapper for MySQL
Other
535 stars 162 forks source link

Signal 11 on SmartOS (solaris derivative) #94

Open kopernikus opened 8 years ago

kopernikus commented 8 years ago

Hi all,

I'm testing with mysql_fdw master and postgres 9.4.6 on:

[root@b8a1c371-2a1b-e1ef-8612-a70eae12cfac ~]# uname -a
SunOS b8a1c371-2a1b-e1ef-8612-a70eae12cfac 5.11 joyent_20160218T022556Z i86pc i386 i86pc Solaris

I had to change a few things to make it compile:

diff --git a/mysql_fdw.c b/mysql_fdw.c
index 53b359b..4f7d8e5 100644
--- a/mysql_fdw.c
+++ b/mysql_fdw.c
@@ -176,7 +176,7 @@ static int interactive_timeout = INTERACTIVE_TIMEOUT;
 bool
 mysql_load_library(void)
 {
-#if defined(__APPLE__)
+#if defined(__APPLE__) || (defined(__sun) && defined(__SVR4))
        /*
         * Mac OS/BSD does not support RTLD_DEEPBIND, but it still
         * works without the RTLD_DEEPBIND

remove --as-needed from linker args and change user/group in bsdinstall.

Foreign server is mysql-5.6 Created the table reference just fine and can query the mysql server exactly once. Executing the same simple SELECT query again crashes the postgres process. Backtrace from coredump is:

[root@b8a1c371-2a1b-e1ef-8612-a70eae12cfac ~]# pstack core.postgres.16611
core 'core.postgres.16611' of 16611:    /opt/local/bin/postgres -D /var/pgsql/data
 00000000008349fb pfree () + b
 0000000000686c35 list_delete_cell () + 35
 fffffd7ffe44c674 mysql_stmt_close () + 54
 fffffd7ffef983c7 mysqlEndForeignScan () + 47
 000000000066d786 ExecEndForeignScan () + 16
 000000000064e867 standard_ExecutorEnd () + 37
 000000000061ee44 PortalCleanup () + b4
 0000000000834edc PortalDrop () + 2c
 000000000073caff PostgresMain () + 1b6f
 000000000084d1fe ServerLoop () + 9dc
 00000000006ea919 PostmasterMain () + e89
 000000000084df16 main () + 586
 000000000051e9cc _start () + 6c

The postgresql log says:

LOG:  server process (PID 16611) was terminated by signal 11
DETAIL:  Failed process was running: select * from users;
LOG:  terminating any other active server processes
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
WARNING:  terminating connection because of crash of another server process
DETAIL:  The postmaster has commanded this server process to roll back the current transaction and exit, because another server process exited abnormally and possibly corrupted shared memory.
HINT:  In a moment you should be able to reconnect to the database and repeat your command.
LOG:  received smart shutdown request
LOG:  abnormal database system shutdown
LOG:  database system was interrupted; last known up at 2016-03-11 18:24:39 UTC
LOG:  database system was not properly shut down; automatic recovery in progress
LOG:  record with zero length at 0/17FF4E8
LOG:  redo is not required
LOG:  MultiXact member wraparound protections are now enabled
LOG:  autovacuum launcher started
LOG:  database system is ready to accept connections

If you need more info, please ask.

ahsanhadi commented 8 years ago

Yeah we haven't tested mysql_fdw on solaris so far. We will look into this once it is prioritised by our product management.

pyhalov commented 6 years ago

This scenario seems to work on OpenIndiana. Perhaps, because we link our components with -Bdirect -zignore.