Bug #50667 The InnoDB plugin prevents initialization of the "embedded" server
Submitted: 27 Jan 2010 16:41 Modified: 14 Oct 2010 14:06
Reporter: Joerg Bruehe Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: Embedded Library ( libmysqld ) Severity:S3 (Non-critical)
Version:5.1.40, 5.1.43 OS:Other (AIX, i5os, FreeBSD, Windows)
Assigned to: Ramil Kalimullin CPU Architecture:Any

[27 Jan 2010 16:41] Joerg Bruehe
Description:
This failure also occurred (at least) in 5.1.40, but was not reported back then. This report is from the 5.1.43 release build.

All tests using the InnoDB plugin don't even start when run "embedded", the symptom is:

=====
main.bug46760 'innodb_plugin'            [ retry-fail ]
        Test ended at YYYY-MM-DD HH:MM:SS

CURRENT_TEST: main.bug46760
mysqltest: Can't initialize MySQL server
Failed to read from '/PATH/mysql-test/var/log/bug46760.log', errno: 22

 - saving '/PATH/mysql-test/var/log/main.bug46760-innodb_plugin/' to '/PATH/mysql-test/var/log/main.bug46760-i
nnodb_plugin/'
=====

(of course, the file to read varies by test name)

This happens on
  AIX 5.3 (PPC, both 32 and 64 bit)
  i5/os   (PPC, both 32 and 64 bit)
  FreeBSD (x86 and x86_64)
On these platforms, it happens in all configurations, and it doesn't show on any other platform.

With the separate server, the plugin loads fine, and these tests pass.

It happens with all tests run using the InnoDB plugin until the failure limit count (10) is reached, and MTR aborts the run:

main.bug46760
main.concurrent_innodb_safelog
main.concurrent_innodb_unsafelog
main.innodb_autoinc_lock_mode_zero
main.innodb_bug30919
main.innodb_bug39438
main.innodb_bug42101-nonzero
main.innodb_mysql_rbk
main.innodb_mysql
main.unsafe_binlog_innodb

How to repeat:
Run the tests "embedded".
[8 Jul 2010 16:30] Vasil Dimov
Could be related to Bug#55089 InnoDB Plugin mysql-tests do not run on Windows/embedded
[8 Jul 2010 18:33] Vasil Dimov
This bug also exists on Windows (PB2)
[15 Jul 2010 15:28] Vladislav Vaintroub
This cannot be made to work on Windows. 
ha_innodb.dll has link and runtime dependency on mysqld.exe, because loader will require mysqld.exe that exports charset_info and other symbols used by ha_innodb.dll

So now, if executable used is mysqltest_embedded.exe and not mysqld.exe, OS loader would not be able to resolve symbols and would not load the library.

To reiterate, Windows loader uses entrypoint+libraryname schema to resolve symbols, it always knows which module contains which entry point (and hence renaming dlls is a bad idea).

OSX with twolevel namespaces has the similar schema.

Linux and general Unixes does not normally bind entry point to library names (although I think for GLIBC there is an exception), instead it uses search in all loaded modules for the exported function. Therefore it appears works on Linux (well,  with some hacks that are still required, -rdynamic, -export-dynamic and all that "export-all" stuff)

The portable solution for this kinds of problem is finding a way to create plugins that do not have dependencies in server. WL#3859 Plug-in Service API  as envisioned as solution for this problem but it was never completely implemented.

So I personally would classify this bug as "No Bug", it would be a bug if it ever portably worked on any platform :)
[15 Jul 2010 20:35] Ramil Kalimullin
Vlad, thank you for the comment submitted.
I've managed to fix the issue on FreeBSD,
will submit a fix shortly.
Maybe, it's worth to file a different bug re Windows.
[16 Jul 2010 7:16] Bugs System
A patch for this bug has been committed. After review, it may
be pushed to the relevant source trees for release in the next
version. You can access the patch from:

  http://lists.mysql.com/commits/113728

3488 Ramil Kalimullin	2010-07-16
      Fix for bug #50667: The InnoDB plugin prevents initialization
      of the "embedded" server
      
      Problem: mysqltest_embedded failed to load ha_innodb_plugin library
      on some platforms (due to some unresolved references).
      
      Fix: on FreeBSD use -export-dynamic flag building mysqltest_embedded.
      That allows to use its global symbols to resolve references in the
      dynamically loaded plugin library.
     @ libmysqld/examples/Makefile.am
        Fix for bug #50667: The InnoDB plugin prevents initialization
        of the "embedded" server
          - use -export-dynamic (on FreeBSD/DragonFly) building
        mysqltest_embedded to allow using its global symbols 
        to resolve references in the dynamically loaded plugin libraries.
[23 Jul 2010 12:25] Bugs System
Pushed into mysql-trunk 5.5.6-m3 (revid:alik@sun.com-20100723121820-jryu2fuw3pc53q9w) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (merge vers: 5.5.5-m3) (pib:18)
[23 Jul 2010 12:31] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100723121929-90e9zemk3jkr2ocy) (version source revid:vasil.dimov@oracle.com-20100531152341-x2d4hma644icamh1) (pib:18)
[28 Jul 2010 19:44] Paul DuBois
Changes to test suite. No changelog entry needed.
[19 Aug 2010 15:40] Bugs System
Pushed into mysql-5.1 5.1.51 (revid:build@mysql.com-20100819151858-muaaor6jojb5ouzj) (version source revid:build@mysql.com-20100819151858-muaaor6jojb5ouzj) (merge vers: 5.1.51) (pib:20)
[14 Oct 2010 8:30] Bugs System
Pushed into mysql-5.1-telco-7.0 5.1.51-ndb-7.0.20 (revid:martin.skold@mysql.com-20101014082627-jrmy9xbfbtrebw3c) (version source revid:martin.skold@mysql.com-20101014082627-jrmy9xbfbtrebw3c) (merge vers: 5.1.51-ndb-7.0.20) (pib:21)
[14 Oct 2010 8:46] Bugs System
Pushed into mysql-5.1-telco-6.3 5.1.51-ndb-6.3.39 (revid:martin.skold@mysql.com-20101014083757-5qo48b86d69zjvzj) (version source revid:martin.skold@mysql.com-20101014083757-5qo48b86d69zjvzj) (merge vers: 5.1.51-ndb-6.3.39) (pib:21)
[14 Oct 2010 9:00] Bugs System
Pushed into mysql-5.1-telco-6.2 5.1.51-ndb-6.2.19 (revid:martin.skold@mysql.com-20101014084420-y54ecj85j5we27oa) (version source revid:martin.skold@mysql.com-20101014084420-y54ecj85j5we27oa) (merge vers: 5.1.51-ndb-6.2.19) (pib:21)
[14 Oct 2010 14:06] Jon Stephens
No changelog entry needed per previous comments; set back to Closed.