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

[ Segmentation fault ] Using SQL\Query->toString__FOR_DEBUGGING_ONLY() causes a segmentation fault when a query is also running #8678

Open
lexidor opened this issue Mar 27, 2020 · 0 comments
Labels

Comments

@lexidor
Copy link
Collaborator

lexidor commented Mar 27, 2020

Describe the bug

A segmentation fault occurs when running when asking for the string repr of a SQL\Query while the connection is busy.

Standalone code, or other way to reproduce the problem

<?hh

use namespace HH\Lib\SQL;

<<__EntryPoint>>
async function main_async(): Awaitable<void> {
    require_once __DIR__.'/../vendor/autoload.hack';
    \Facebook\AutoloadMap\initialize();

    $config = /*my config*/;

    $async_conn = await AsyncMysqlClient::connect($config->servername, 3306, $config->dbname, $config->username, $config->password);

    concurrent {
        await func_async($async_conn, new SQL\Query('SELECT %s', 'something'));
        await func_async($async_conn, new SQL\Query('SELECT %s', 'something'));
    }
}

async function func_async(AsyncMysqlConnection $asyncMysql, SQL\Query $query): Awaitable<void> {
    $query->toString__FOR_DEBUGGING_ONLY($asyncMysql);
    await $asyncMysql->queryf('SELECT %s', 'something');
}

Steps to reproduce the behavior:

Have a SQL server running.
I used 10.4.11-MariaDB-1:10.4.11+maria~bionic-log.
Run the example code above.
Read stacktrace from /tmp/stacktrace.xxxxx.log

Expected behavior
Code completes silently.

Screenshots
NONE

Desktop (please complete the following information):

  • OS: Ubuntu 18.04.4 LTS
  • HHVM Version: 4.51.0
HipHop VM 4.51.0-dev (rel)
Compiler: 1585280615_594927537
Repo schema: ac933c8afa79ac54d3ec9e7de7983d3b2a7977f5

Additional context
Stacktrace

Host: lexidor-Cloud-VM
ProcessID: 27372
ThreadID: 140689418532416
ThreadPID: 27372
Name: /usr/bin/hhvm
CmdLine: hhvm library/autoload.php
Type: Segmentation fault
Runtime: hhvm
Version: 1585280615_594927537
DebuggerCount: 0

Arguments: library/autoload.php
ThreadType: CLI

# 0  000055811f319ee6
# 1  000055811f5e2a95
# 2  00007ff4cccaf890
# 3  00005581204c9fe5
# 4  0000558129214953
# 5  000055812921489b
# 6  0000558129215018
# 7  0000558125600491
# 8  000055811fc0b703
# 9  000055811f5fed22
# 10 000055812049cb96
# 11 00005581204af8b8
# 12 00005581204a9eab
# 13 0000558129200631
# 14 000055812920055d
# 15 0000558125600491
# 16 000055811fc0b703
# 17 000055811f978ae0
# 18 000055811f602dd6
# 19 0000558121296861
# 20 0000558121296688
# 21 00005581212963d0
# 22 000055811f684622
# 23 000055811f6855f2
# 24 000055811f68e3e5
# 25 000055811f6901ce
# 26 000055811f2a0974
# 27 00007ff4c61ccb97
# 28 000055811f29dc2a

PHP Stacktrace:

#0  HH\Lib\SQL\Query->toString__FOR_DEBUGGING_ONLY() called at [autoload.php:21]
#1  func_async() called at [autoload.php:16]
#2  main_async()
#3  Closure$__SystemLib\enter_async_entry_point()
#4  HH\Asio\join()
#5  __SystemLib\enter_async_entry_point()
@lexidor lexidor added the crash label Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant