[mysql] close connection causes segfault

Open
#415 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
42/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
c, mysql
Domain
databases

Research direction

Reproduce the crash through MysqlConnection.close() on both the HashLink virtual machine and native C compile, using the versions and Server.hx:12 setup described. Inspect close_wrap in mysql.c, especially the mp_close(c->c) call, and compare it with the Mysql.hx:140 path; done means closing the connection no longer segfaults in either runtime.

Written by the indexing model from the issue text.

Description

Using MysqlConnection.close() causes segfault using either hashlink virtual machine or native c code.

Using HL/JIT 1.11.0
And Mysql: mysql Ver 15.1 Distrib 10.5.5-MariaDB, for Linux (x86_64) using readline 5.1
Outputs:
HL Virtual Machine

SIGNAL 11
sys.db._Mysql.MysqlConnection.close(/usr/share/haxe/std/hl/_std/sys/db/Mysql.hx:140)
$Server.main(Server.hx:12)
fun$430(?:1)
@0x5A4E9310
zsh: segmentation fault (core dumped) 

Native C Compile

zsh: segmentation fault (core dumped)  ./a.out

Problem is caused exactly in close_wrap function in mysql.c: mp_close(c->c)

Unsure if it's mysql bug or hashlink.

Dominant language
C
Stars
911
Forks
207
Avg merge
1d 21h
Merged PRs (30d)
13

Getting set up

This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from HaxeFoundation/hashlink

All issues in HaxeFoundation/hashlink

Similar issues

More C issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.