Skip to content

Commit e91c99a

Browse files
committed
Drop temporary_table_exists patch — Turso deadlocks during run, not shutdown
Re-running with the patch on showed it's not a shutdown-only hang: PHPUnit makes it to ~test 504/667 and then tests stop advancing. The Turso deadlock is triggered by driver code paths the patch opens up, and can't be undone from the PHP side. Keep only wp_die polyfill and the PHPUnit timeout wrapper (still useful as a safety net).
1 parent af06534 commit e91c99a

1 file changed

Lines changed: 19 additions & 33 deletions

File tree

.github/workflows/phpunit-tests-turso.yml

Lines changed: 19 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -428,39 +428,25 @@ jobs:
428428
working-directory: packages/mysql-on-sqlite
429429
run: |
430430
python3 - <<'PY'
431-
# 1. Turso doesn't expose `sqlite_temp_master`. The driver queries it
432-
# to decide whether to use temp-schema tables, but Turso doesn't
433-
# support TEMP tables at all, so the predicate is always false.
434-
path = 'src/sqlite/class-wp-sqlite-information-schema-builder.php'
435-
src = open(path).read()
436-
old = (
437-
"\tpublic function temporary_table_exists( string $table_name ): bool {\n"
438-
"\t\t/*\n"
439-
"\t\t * We could search in the \"{$this->temporary_table_prefix}tables\" table,\n"
440-
"\t\t * but it may not exist yet, so using \"sqlite_temp_master\" is simpler.\n"
441-
"\t\t */\n"
442-
"\t\t$stmt = $this->connection->query(\n"
443-
"\t\t\t\"SELECT 1 FROM sqlite_temp_master WHERE type = 'table' AND name = ?\",\n"
444-
"\t\t\tarray( $table_name )\n"
445-
"\t\t);\n"
446-
"\t\treturn $stmt->fetchColumn() === '1';\n"
447-
"\t}"
448-
)
449-
new = (
450-
"\tpublic function temporary_table_exists( string $table_name ): bool {\n"
451-
"\t\t// Turso compatibility: it does not support TEMP tables or\n"
452-
"\t\t// expose sqlite_temp_master, so this is always false.\n"
453-
"\t\treturn false;\n"
454-
"\t}"
455-
)
456-
assert old in src, 'temporary_table_exists body not found'
457-
src = src.replace(old, new, 1)
458-
open(path, 'w').write(src)
459-
print('patched information-schema-builder.php (temporary_table_exists)')
460-
461-
# 2. wp_die polyfill: real WordPress provides wp_die(); the unit-test
462-
# bootstrap doesn't, so 21 tests hit an 'undefined function' error
463-
# when a driver error path tries to call it.
431+
# Driver patches ATTEMPTED and abandoned:
432+
#
433+
# - temporary_table_exists → false: would save ~250 errors from
434+
# 'no such table: sqlite_temp_master', but changing the predicate's
435+
# return value makes the driver take code paths that deadlock inside
436+
# Turso's sqlite3_finalize during subsequent tests (gdb traces show
437+
# a mutex on sqlite3Inner held across the step->finalize cycle).
438+
# Requires a Turso fix.
439+
#
440+
# - sync_column_key_info row-value UPDATE rewrite: valid SQL, but
441+
# triggers a pathological case in Turso's query planner that hangs
442+
# PHPUnit somewhere after test 504/667.
443+
#
444+
# Only the wp_die polyfill is safe; it doesn't change driver/query
445+
# behaviour.
446+
447+
# wp_die polyfill: real WordPress provides wp_die(); the unit-test
448+
# bootstrap doesn't, so 21 tests hit an 'undefined function' error
449+
# when a driver error path tries to call it.
464450
path = 'tests/bootstrap.php'
465451
src = open(path).read()
466452
marker = "if ( ! function_exists( 'do_action' ) ) {"

0 commit comments

Comments
 (0)