Skip to content
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

[ERROR] ProxySQL crashed. Restarting! #1638

Closed
dmstahl opened this issue Aug 8, 2018 · 6 comments
Closed

[ERROR] ProxySQL crashed. Restarting! #1638

dmstahl opened this issue Aug 8, 2018 · 6 comments

Comments

@dmstahl
Copy link

dmstahl commented Aug 8, 2018

I am running ProxySQL version 1.4.9-3-gd9fd599 on Ubuntu 16.04.1 and received the following error:

Error: signal 11:
proxysql(_Z13crash_handleri+0x2d)[0x449e4d]
/lib/x86_64-linux-gnu/libc.so.6(+0x354b0)[0x7fe2ffdc64b0]
proxysql(net_field_length+0x3)[0x62db73]
proxysql(mthd_stmt_read_all_rows+0x163)[0x638973]
proxysql(mysql_stmt_store_result+0x8a)[0x63a89a]
proxysql[0x634b38]
proxysql(my_context_spawn+0x41)[0x633b11]
2018-08-08 10:52:32 main.cpp:905:ProxySQL_daemonize_phase3(): [ERROR] ProxySQL crashed. Restarting!

@renecannao
Copy link
Contributor

Do you have a core dump?

@dmstahl
Copy link
Author

dmstahl commented Aug 8, 2018

Hi @renecannao, I sent you a link to the core dump. Thanks!

@dmstahl
Copy link
Author

dmstahl commented Aug 10, 2018

The query that we are running when we receive the crash is returning some JSON data from the database. The crash appears to happen when the JSON data is 254-255 bytes (or is 509-510 bytes -> a multiple of 255 or one byte less than a multiple of 255) AND contains a null character.

@c4l3b
Copy link

c4l3b commented Nov 5, 2018

Attached is a test to make ProxySQL crash with this error.

  • Run the CreateTestTable.sql to create the table and data.
  • Adjust the connection variables at the top of test.php.
  • Run the test.php using PHP (tested with 7.1 here).

After further testing, the crash might have more to do with the entire length of the row rather than just the length of the JSON.

Proxysql-JSON-crash.zip

@altmannmarcelo
Copy link

The error doesn't happen if bellow attribute is set:

        PDO::ATTR_EMULATE_PREPARES => TRUE,

@renecannao - This may be related to https://github.com/MariaDB/mariadb-connector-c/pull/38/files ?

When querying mysql directly it's getting 2036 error:

[root@marcelo-altmann-240074-proxysql-1 ~]# php a.php
Error: exception 'PDOException' with message 'SQLSTATE[HY000]: General error: 2036 ' in /root/a.php:20
Stack trace:
#0 /root/a.php(20): PDO->query('SELECT * FROM t...')
#1 {main}

mysql->read_pos is null:

(gdb) p pos
$8 = (uchar *) 0x17d0c3c000 <Address 0x17d0c3c000 out of bounds>
(gdb) p *mysql
$9 = {net = {vio = 0x7ff0d0024280, buff = 0x7ff0d00ed000 "\n", buff_end = 0x7ff0d00ef000 "", write_pos = 0x7ff0d00ed000 "\n",
    read_pos = 0x7ff0d00ed000 "\n", fd = 28, remain_in_buf = 0, length = 0, buf_length = 0, where_b = 0, max_packet = 8192,
    max_packet_size = 1073741824, pkt_nr = 1, compress_pkt_nr = 0, write_timeout = 0, read_timeout = 30, retry_count = 0,
    fcntl = 0, return_status = 0x0, reading_or_writing = 0 '\000', save_char = 0 '\000', unused_1 = 0 '\000', unused_2 = 0 '\000',
    compress = 0 '\000', unused_3 = 0 '\000', unused_4 = 0x0, last_errno = 0, error = 0 '\000', unused_5 = 0 '\000',
    unused_6 = 0 '\000', last_error = '\000' <repeats 511 times>, sqlstate = "00000", extension = 0x0}, unused_0 = 0x0,
  host = 0x7ff0d00174d8 "172.16.2.220", user = 0x7ff0d0023090 "root",
  passwd = 0x7ff0d001cc20 "*a1b9892611956aa13a5ab9ccf01f49662583f2d2", unix_socket = 0x0,
  server_version = 0x7ff0d00181c0 "5.7.23-23-57", host_info = 0x7ff0d00174c0 "172.16.2.220 via TCP/IP", info = 0x0,
  db = 0x7ff0d0023098 "marcelo", charset = 0x9a9ef8 <compiled_charsets+3672>, fields = 0x0, field_alloc = {free = 0x7ff0d00f1000,
    used = 0x0, pre_alloc = 0x0, min_malloc = 32, block_size = 8168, block_num = 5, first_block_usage = 0, error_handler = 0x0},
  affected_rows = 18446744073709551615, insert_id = 0, extra_info = 0, thread_id = 12088, packet_length = 7, port = 3306,
  client_flag = 2073231, server_capabilities = 18446744072669364223, protocol_version = 10, field_count = 9, server_status = 2,
  server_language = 8, warning_count = 0, options = {connect_timeout = 1, read_timeout = 0, write_timeout = 0, port = 0,
    protocol = 0, client_flag = 128, host = 0x0, user = 0x0, password = 0x0, unix_socket = 0x0, db = 0x0, init_command = 0x0,
    my_cnf_file = 0x0, my_cnf_group = 0x0, charset_dir = 0x0, charset_name = 0x7ff0d0023088 "utf8", ssl_key = 0x0, ssl_cert = 0x0,
    ssl_ca = 0x0, ssl_capath = 0x0, ssl_cipher = 0x0, shared_memory_base_name = 0x0, max_allowed_packet = 0, use_ssl = 0 '\000',
    compress = 0 '\000', named_pipe = 0 '\000', unused_1 = 0 '\000', unused_2 = 0 '\000', unused_3 = 0 '\000', unused_4 = 0 '\000',
    methods_to_use = MYSQL_OPT_CONNECT_TIMEOUT, bind_address = 0x0, secure_auth = 0 '\000', report_data_truncation = 0 '\000',
    local_infile_init = 0x0, local_infile_read = 0x0, local_infile_end = 0x0, local_infile_error = 0x0, local_infile_userdata = {
      0x0, 0x0}, extension = 0x7ff0d00e8000}, status = MYSQL_STATUS_READY, free_me = 1 '\001', reconnect = 0 '\000',
  scramble_buff = "mN\024%\024_;%\r*?g\003m*mb>U>", unused_1 = 0 '\000', unused_2 = 0x0, unused_3 = 0x0, unused_4 = 0x0,
  unused_5 = 0x0, stmts = 0x7ff0d0c3c310, methods = 0x9b0680 <MARIADB_DEFAULT_METHODS>, thd = 0x0, unbuffered_fetch_owner = 0x0,
  info_buffer = 0x0, extension = 0x0}

renecannao added a commit that referenced this issue Nov 23, 2018
@renecannao
Copy link
Contributor

Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants