Skip to content

Commit 1a5eeab

Browse files
committed
ci diag: vendor libsql with idempotent disconnect() to test the double-close theory
1 parent adae832 commit 1a5eeab

72 files changed

Lines changed: 16843 additions & 88 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/CI.yml‎

Lines changed: 2 additions & 88 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,6 @@ jobs:
153153
target: x86_64-pc-windows-msvc
154154
node:
155155
- '22'
156-
- '24'
157156
runs-on: ${{ matrix.settings.host }}
158157
steps:
159158
- uses: actions/checkout@v4
@@ -182,102 +181,17 @@ jobs:
182181
- name: Install test dependencies
183182
shell: pwsh
184183
run: cd integration-tests && npm i
185-
- name: Enable WER crash dumps
186-
shell: pwsh
187-
run: |
188-
$ws = "${{ github.workspace }}"
189-
$wer = "HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting"
190-
New-Item -Path $wer -Force | Out-Null
191-
Set-ItemProperty -Path $wer -Name Disabled -Value 0 -Type DWord
192-
Set-ItemProperty -Path $wer -Name DontShowUI -Value 1 -Type DWord
193-
foreach ($k in @("$wer\LocalDumps", "$wer\LocalDumps\node.exe")) {
194-
New-Item -Path $k -Force | Out-Null
195-
Set-ItemProperty -Path $k -Name DumpFolder -Value "$ws\crashdumps"
196-
Set-ItemProperty -Path $k -Name DumpType -Value 2 -Type DWord
197-
Set-ItemProperty -Path $k -Name DumpCount -Value 10 -Type DWord
198-
}
199-
New-Item -ItemType Directory -Force -Path "$ws\crashdumps" | Out-Null
200-
try { Set-Service WerSvc -StartupType Manual; Start-Service WerSvc; Write-Host "=== WerSvc: $((Get-Service WerSvc).Status)" } catch { Write-Host "=== WerSvc start failed: $_" }
201-
- name: Probe that a crashing node writes a dump
202-
shell: pwsh
203-
continue-on-error: true
204-
run: |
205-
node --stack-size=65500 -e "function f(){return f()+1} f()"
206-
Write-Host "=== probe exit code: $LASTEXITCODE"
207-
Start-Sleep -Seconds 5
208-
Get-ChildItem "${{ github.workspace }}\crashdumps" | ForEach-Object { Write-Host "=== probe dump: $($_.Name) $($_.Length)" }
209-
- name: Run sync suite under cdb with the debug heap disabled
184+
- name: Plain pwsh loop (100 runs)
210185
shell: pwsh
211-
continue-on-error: true
212-
run: |
213-
$ws = "${{ github.workspace }}"
214-
$cdb = "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\cdb.exe"
215-
New-Item -ItemType Directory -Force -Path "$ws\syms" | Out-Null
216-
try {
217-
$v = (node --version).TrimStart('v')
218-
Invoke-WebRequest -Uri "https://nodejs.org/dist/v$v/win-x64/node_pdb.zip" -OutFile "$ws\node_pdb.zip"
219-
Expand-Archive -Path "$ws\node_pdb.zip" -DestinationPath "$ws\syms" -Force
220-
} catch { Write-Host "node pdb download failed: $_" }
221-
$script = "$ws\cdb-script.txt"
222-
@'
223-
sxe -c "!analyze -v;.ecxr;kv 60;lm m libsql*;~*kv 40;q" av
224-
sxe -c "!analyze -v;.ecxr;kv 60;lm m libsql*;~*kv 40;q" sov
225-
sxe -c "!analyze -v;.ecxr;kv 60;lm m libsql*;~*kv 40;q" ii
226-
g
227-
'@ | Set-Content -Path $script
228-
$node = (Get-Command node).Source
229-
$env:LIBSQL_JS_DEV = "1"
230-
$env:PROVIDER = "libsql"
231-
$env:_NO_DEBUG_HEAP = "1"
232-
$env:_NT_SYMBOL_PATH = "srv*$ws\symcache*https://msdl.microsoft.com/download/symbols;$ws\syms;$ws"
233-
Set-Location integration-tests
234-
$crashed = $false
235-
foreach ($i in 1..100) {
236-
& $cdb -G -lines -cf $script $node node_modules\ava\entrypoints\cli.mjs tests\sync.test.js > "$ws\cdb-run-$i.log" 2>&1
237-
if (Select-String -Path "$ws\cdb-run-$i.log" -Pattern 'EXCEPTION_CODE' -Quiet) {
238-
$crashed = $true
239-
Write-Host "=== cdb (no debug heap) crash captured on run $i, full debugger output follows"
240-
Get-Content "$ws\cdb-run-$i.log"
241-
break
242-
}
243-
}
244-
if (-not $crashed) { Write-Host "=== cdb (no debug heap): no crash in 100 runs" }
245-
- name: Plain pwsh loop
246-
shell: pwsh
247-
continue-on-error: true
248186
run: |
249187
cd integration-tests
250188
$fails = 0
251189
foreach ($i in 1..100) {
252190
npm run test:libsql | Out-Null
253191
if ($LASTEXITCODE -ne 0) { $fails++; Write-Host "=== plain run $i exit code: $LASTEXITCODE" }
254-
if ($fails -ge 2) { break }
255192
}
256-
Write-Host "=== plain total failures: $fails (stopped after 2 or at 100)"
193+
Write-Host "=== plain total failures: $fails / 100"
257194
exit $fails
258-
- name: Analyze crash dumps
259-
if: always()
260-
shell: pwsh
261-
run: |
262-
$ws = "${{ github.workspace }}"
263-
$cdb = "C:\Program Files (x86)\Windows Kits\10\Debuggers\x64\cdb.exe"
264-
$env:_NT_SYMBOL_PATH = "srv*$ws\symcache*https://msdl.microsoft.com/download/symbols;$ws\syms;$ws"
265-
$dumps = Get-ChildItem "$ws\crashdumps" -Filter *.dmp -ErrorAction SilentlyContinue
266-
if (-not $dumps) { Write-Host "=== no WER dumps" }
267-
foreach ($d in $dumps) {
268-
Write-Host "=== dump $($d.Name) $($d.Length)"
269-
& $cdb -z $d.FullName -lines -c "!analyze -v; .ecxr; kv 60; lm m libsql*; ~*kv 30; q" > "$ws\analysis-$($d.BaseName).txt" 2>&1
270-
Get-Content "$ws\analysis-$($d.BaseName).txt"
271-
}
272-
- name: Upload diagnostics
273-
if: always()
274-
uses: actions/upload-artifact@v4
275-
with:
276-
name: windows-diagnostics
277-
path: |
278-
analysis-*.txt
279-
cdb-run-*.log
280-
if-no-files-found: ignore
281195
test-linux-x64-gnu-binding:
282196
name: Test bindings on Linux-x64-gnu - node@${{ matrix.node }}
283197
needs:

‎Cargo.toml‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,3 +32,6 @@ napi-build = "2.0.1"
3232

3333
[profile.release]
3434
lto = true
35+
36+
[patch.crates-io]
37+
libsql = { path = "diag/libsql" }

‎diag/libsql/.cargo-ok‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{"v":1}

‎diag/libsql/.cargo_vcs_info.json‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"git": {
3+
"sha1": "ef758d96b9424a2d506f7e417f84b42b9b9a5412"
4+
},
5+
"path_in_vcs": "libsql"
6+
}

0 commit comments

Comments
 (0)