Bug #23368 crash during insert, table has foreign key pointing into other schema,permission
Submitted: 17 Oct 2006 12:37 Modified: 18 Jun 2010 12:50
Reporter: Matthias Leich Email Updates:
Status: Closed Impact on me:
None 
Category:MySQL Server: InnoDB storage engine Severity:S1 (Critical)
Version:5.1 OS:Any
Assigned to: Marko Mäkelä CPU Architecture:Any

[17 Oct 2006 12:37] Matthias Leich
Description:
Heavily simplified test derived from NIST tests: schema8, schema9, sultab1

CREATE USER mysqltest@localhost identified by 'PWD';
DROP TABLE IF EXISTS test.t2;
DROP SCHEMA IF EXISTS mysqltest;
CREATE SCHEMA mysqltest ;
GRANT ALL ON mysqltest.* TO mysqltest@localhost;
GRANT ALL ON test.* TO mysqltest@localhost;
# Establish connection mysqltest (user = mysqltest)
USE mysqltest;
CREATE TABLE t1
(EMPNUM   CHAR(3) NOT NULL,
UNIQUE  (EMPNUM)) ENGINE = InnoDB;
CREATE TABLE test.t2
(EMPNUM   CHAR(3),
PNUM     CHAR(3),
FOREIGN KEY (EMPNUM) REFERENCES mysqltest.t1(EMPNUM)) ENGINE = InnoDB;
INSERT INTO test.t2 VALUES  ('E1','P1');
--------->
  At line 40: query 'INSERT INTO test.t2 VALUES  ('E1','P1')' failed:
                   2013: Lost connection to MySQL server during query
The correct server response was till about mid of September
an error message about FOREIGN KEY constraint violation.

My environment:
 - PC Intel Pentium M (x86-32Bit) with Linux(SuSE 10.1)
 - MySQL compiled from source
     mysql-5.1 last ChangeSet@1.2311, 2006-10-13
     BUILD/compile-pentium-debug-max

Note: The current MySQL 5.0 ChangeSet@1.2280, 2006-10-13
      does not show this crash, but both (5.0,5.1) suffer from
      Bug#23366. The reason for Bug#23366 causes probably
      the current crash.
      Experiments with root user instead of mysqltest user or
      all tables within mysqltest schema do not show this crash.

Mixup of master.err and stacktrace:
CURRENT_TEST: n1
mysqld got signal 11;
This could be because you hit a bug. ....
key_buffer_size=1048576
read_buffer_size=131072
max_used_connections=2
max_connections=100
threads_connected=2
It is possible that mysqld could use up to
key_buffer_size + (read_buffer_size + sort_buffer_size)*max_connections = 39420 K
bytes of memory
Hope that's ok; if not, decrease some variables in the equation.

thd=0x8fcee20
Attempting backtrace. You can use the following information to find out
where mysqld died. If you see no messages after this, something went
terribly wrong...
Cannot determine thread, fp=0xb373f588, backtrace may not be correct.
Stack range sanity check OK, backtrace follows:
0x8251923 handle_segfault + 491
0x845ab07 innobase_print_identifier + 149
0x84aec3e ut_print_namel + 169
0x84d0baf dict_print_info_on_foreign_key_in_create_format + 537
0x848063e row_ins_set_detailed + 139
0x8480983 row_ins_foreign_report_add_err + 32
0x8481f4f row_ins_check_foreign_constraint + 1833
Stack trace seems successful - bottom reached
Please read http://dev.mysql.com/doc/mysql/en/using-stack-trace.html and follow instructions on how to resolve the stack trace. Resolved
stack trace is much more helpful in diagnosing the problem, so please do
resolve it
Trying to get some variables.
Some pointers may be invalid and cause the dump to abort...
thd->query at (nil)  is invalid pointer
thd->thread_id=0
The manual page at http://www.mysql.com/doc/en/Crashing.html contains
information that should help you find out what is causing the crash.
Writing a core file

How to repeat:
Please use the attached file:
cd <top directory of release>/mysql-test
cp n1.test t
echo "Dummy" > r/n1.result # Create dummy result file
./mysql-test-run --skip-ndb n1
[17 Oct 2006 12:40] Matthias Leich
test script

Attachment: n1.test (application/octet-stream, text), 1.66 KiB.

[17 Oct 2006 12:51] Heikki Tuuri
Marko,

please look at this identifier printing crash in the fresh 5.1.

Regards,

Heikki
[17 Oct 2006 14:56] Marko Mäkelä
Sorry, the wrong length was passed to ut_print_namel() in dict_print_info_on_foreign_key_in_create_format().
[21 Oct 2006 5:12] Timothy Smith
Patch queued to -maint tree (5.1).  Will be merged to global tree when possible.
[7 Nov 2006 20:21] Marko Mäkelä
Proposed changelog entry:
InnoDB crashed when trying to display an error message about foreign key constraint violation when the two tables are in different schemas (databases).
[9 Nov 2006 14:44] Paul Dubois
Marko, thanks.

Noted in 5.1.13 changelog.
[5 May 2010 15:03] Bugs System
Pushed into 5.1.47 (revid:joro@sun.com-20100505145753-ivlt4hclbrjy8eye) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[6 May 2010 2:31] Paul Dubois
Push resulted from incorporation of InnoDB tree. No changes pertinent to this bug. Re-closing.
[28 May 2010 5:46] Bugs System
Pushed into mysql-next-mr (revid:alik@sun.com-20100524190136-egaq7e8zgkwb9aqi) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (pib:16)
[28 May 2010 6:16] Bugs System
Pushed into 6.0.14-alpha (revid:alik@sun.com-20100524190941-nuudpx60if25wsvx) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[28 May 2010 6:43] Bugs System
Pushed into 5.5.5-m3 (revid:alik@sun.com-20100524185725-c8k5q7v60i5nix3t) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[29 May 2010 2:50] Paul Dubois
Push resulted from incorporation of InnoDB tree. No changes pertinent to this bug.
Re-closing.
[17 Jun 2010 11:45] Bugs System
Pushed into 5.1.47-ndb-7.0.16 (revid:martin.skold@mysql.com-20100617114014-bva0dy24yyd67697) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 12:23] Bugs System
Pushed into 5.1.47-ndb-6.2.19 (revid:martin.skold@mysql.com-20100617115448-idrbic6gbki37h1c) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)
[17 Jun 2010 13:10] Bugs System
Pushed into 5.1.47-ndb-6.3.35 (revid:martin.skold@mysql.com-20100617114611-61aqbb52j752y116) (version source revid:vasil.dimov@oracle.com-20100331130613-8ja7n0vh36a80457) (merge vers: 5.1.46) (pib:16)