tursodatabase / tursodatabase/libsql

Invalid kernel address exception on connection close

Open
#419 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C
Stars
17.2k
Forks
531
Avg merge
1h 12m
Merged PRs (30d)
1

Description

Reported by Alexey Orlenko:

-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               node [11985]
Path:                  /Users/USER/*/node
Identifier:            node
Version:               ???
Code Type:             ARM-64 (Native)
Parent Process:        bash [11983]
Responsible:           alacritty [4397]
User ID:               501

Date/Time:             2023-09-21 22:01:39.6144 +0200
OS Version:            macOS 13.5.2 (22G91)
Report Version:        12
Anonymous UUID:        D4DFF34E-7566-D35A-7435-D19F652D17E0

Sleep/Wake UUID:       8107A074-4EF4-48D5-B0D3-0E46347C37C4

Time Awake Since Boot: 310000 seconds
Time Since Wake:       25347 seconds

System Integrity Protection: enabled

Crashed Thread:        0  Dispatch queue: com.apple.main-thread

Exception Type:        EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:       KERN_INVALID_ADDRESS at 0x3d2072656469766f -> 0x000072656469766f (possible pointer authentication failure)
Exception Codes:       0x0000000000000001, 0x3d2072656469766f

VM Region Info: 0x72656469766f is not in any region.  Bytes after previous region: 20226148759152  
      REGION TYPE                    START - END         [ VSIZE] PRT/MAX SHRMOD  REGION DETAIL
      MALLOC_NANO (reserved)   600018000000-600020000000 [128.0M] rw-/rwx SM=NUL  ...(unallocated)
--->  
      UNUSED SPACE AT END

Kernel Triage:
VM - (arg = 0x0) pmap_enter retried due to resource shortage
VM - (arg = 0x0) pmap_enter retried due to resource shortage
VM - (arg = 0x0) pmap_enter retried due to resource shortage


Thread 0 Crashed::  Dispatch queue: com.apple.main-thread
0   libsystem_pthread.dylib       	       0x1932ce558 pthread_mutex_lock + 12
1   index.node                    	       0x119527414 sqlite3Close + 88
2   index.node                    	       0x11931966c core::ptr::drop_in_place$LT$libsql..v1..connection..Connection$GT$::h716160709af6f4d1 + 76
3   index.node                    	       0x119318d70 core::ptr::drop_in_place$LT$libsql..v2..rows..LibsqlRows$GT$::h0a37d749b669f69d + 20
4   index.node                    	       0x119318d70 core::ptr::drop_in_place$LT$libsql..v2..rows..LibsqlRows$GT$::h0a37d749b669f69d + 20
5   index.node                    	       0x119318d70 core::ptr::drop_in_place$LT$libsql..v2..rows..LibsqlRows$GT$::h0a37d749b669f69d + 20
6   index.node                    	       0x119318d70 core::ptr::drop_in_place$LT$libsql..v2..rows..LibsqlRows$GT$::h0a37d749b669f69d + 20
7   index.node                    	       0x119318d70 core::ptr::drop_in_place$LT$libsql..v2..rows..LibsqlRows$GT$::h0a37d749b669f69d + 20
8   index.node                    	       0x119318d70 core::ptr::drop_in_place$LT$libsql..v2..rows..LibsqlRows$GT$::h0a37d749b669f69d + 20
9   index.node                    	       0x119318d70 core::ptr::drop_in_place$LT$libsql..v2..rows..LibsqlRows$GT$::h0a37d749b669f69d + 20
10  index.node                    	       0x119318d70 core::ptr::drop_in_place$LT$libsql..v2..rows..LibsqlRows$GT$::h0a37d749b669f69d + 20
11  index.node                    	       0x119318d70 core::ptr::drop_in_place$LT$libsql..v2..rows..LibsqlRows$GT$::h0a37d749b669f69d + 20
12  index.node                    	       0x119318d70 core::ptr::drop_in_place$LT$libsql..v2..rows..LibsqlRows$GT$::h0a37d749b669f69d + 20
13  index.node                    	       0x119318d70 core::ptr::drop_in_place$LT$libsql..v2..rows..LibsqlRows$GT$::h0a37d749b669f69d + 20
14  index.node                    	       0x119318d70 core::ptr::drop_in_place$LT$libsql..v2..rows..LibsqlRows$GT$::h0a37d749b669f69d + 20

Contributor guide

Open the contributing guide

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.

Research direction

Start with the reported macOS ARM crash stack, especially sqlite3Close, libsql connection cleanup, and LibsqlRows destruction. Reproduce the failure during connection close if possible, then trace the cleanup path and verify that closing connections and rows no longer causes the invalid-address crash.

Written by the indexing model from the issue text.

Assessment

Tech stack
node.js, rust, sqlite
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.