Skip to content

Commit 97f6d7f

Browse files
committed
Fix libsql error
Better logs for android launch Use new op-server lock Increase timeouts Change port Change port patch package op-test Debug Get rid of disk cleaner images have bigger disks now Get rid of server update iOS test script Android script Increase timeouts Remove timeouts test ios Background task killer Thread pool fix clean up
1 parent 9d0aeb2 commit 97f6d7f

File tree

11 files changed

+1295
-1086
lines changed

11 files changed

+1295
-1086
lines changed

.github/workflows/ci.yml

Lines changed: 73 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Typecheck files
1515
run: yarn typecheck
1616

17-
test-ios:
17+
ios:
1818
runs-on: macos-latest
1919
steps:
2020
- name: Checkout
@@ -56,7 +56,7 @@ jobs:
5656
run: |
5757
./scripts/test-ios.sh
5858
59-
test-ios-embedded:
59+
ios-embedded:
6060
runs-on: macos-latest
6161
steps:
6262
- name: Checkout
@@ -98,7 +98,7 @@ jobs:
9898
run: |
9999
./scripts/test-ios.sh
100100
101-
test-ios-sqlcipher:
101+
ios-sqlcipher:
102102
runs-on: macos-latest
103103
steps:
104104
- name: Checkout
@@ -140,7 +140,7 @@ jobs:
140140
run: |
141141
./scripts/test-ios.sh
142142
143-
test-ios-libsql:
143+
ios-libsql:
144144
runs-on: macos-latest
145145
steps:
146146
- name: Checkout
@@ -182,25 +182,25 @@ jobs:
182182
run: |
183183
./scripts/test-ios.sh
184184
185-
test-android:
185+
android:
186186
runs-on: ubuntu-latest
187-
timeout-minutes: 20
187+
timeout-minutes: 40
188188
steps:
189-
- name: Free Disk Space (Ubuntu)
190-
uses: insightsengineering/disk-space-reclaimer@v1
191-
with:
192-
# this might remove tools that are actually needed,
193-
# if set to "true" but frees about 6 GB
194-
tools-cache: false
195-
196-
# all of these default to true, but feel free to set to
197-
# "false" if necessary for your workflow
198-
android: false
199-
dotnet: true
200-
haskell: true
201-
large-packages: true
202-
swap-storage: true
203-
docker-images: true
189+
# - name: Free Disk Space (Ubuntu)
190+
# uses: insightsengineering/disk-space-reclaimer@v1
191+
# with:
192+
# # this might remove tools that are actually needed,
193+
# # if set to "true" but frees about 6 GB
194+
# tools-cache: false
195+
196+
# # all of these default to true, but feel free to set to
197+
# # "false" if necessary for your workflow
198+
# android: false
199+
# dotnet: true
200+
# haskell: true
201+
# large-packages: true
202+
# swap-storage: true
203+
# docker-images: true
204204

205205
- name: Checkout
206206
uses: actions/checkout@v4
@@ -236,15 +236,15 @@ jobs:
236236
# ~/.android/adb*
237237
# key: avd-29
238238

239-
- name: create AVD and generate snapshot for caching
240-
# if: steps.avd-cache.outputs.cache-hit != 'true'
241-
uses: reactivecircus/android-emulator-runner@v2
242-
with:
243-
api-level: 29
244-
force-avd-creation: false
245-
emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
246-
disable-animations: false
247-
script: echo "Generated AVD snapshot for caching."
239+
# - name: create AVD and generate snapshot for caching
240+
# # if: steps.avd-cache.outputs.cache-hit != 'true'
241+
# uses: reactivecircus/android-emulator-runner@v2
242+
# with:
243+
# api-level: 29
244+
# force-avd-creation: false
245+
# emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none
246+
# disable-animations: false
247+
# script: echo "Generated AVD snapshot for caching."
248248

249249
- name: Give execute permissions to script
250250
run: chmod +x ./scripts/test-android.sh
@@ -259,25 +259,33 @@ jobs:
259259
script: |
260260
./scripts/test-android.sh
261261
262-
test-android-sqlcipher:
262+
- name: Upload Android diagnostics
263+
if: failure()
264+
uses: actions/upload-artifact@v4
265+
with:
266+
name: android-logcat-${{ github.job }}
267+
path: example/android-logcat.txt
268+
if-no-files-found: ignore
269+
270+
android-sqlcipher:
263271
runs-on: ubuntu-latest
264-
timeout-minutes: 20
272+
timeout-minutes: 40
265273
steps:
266-
- name: Free Disk Space (Ubuntu)
267-
uses: insightsengineering/disk-space-reclaimer@v1
268-
with:
269-
# this might remove tools that are actually needed,
270-
# if set to "true" but frees about 6 GB
271-
tools-cache: false
272-
273-
# all of these default to true, but feel free to set to
274-
# "false" if necessary for your workflow
275-
android: false
276-
dotnet: true
277-
haskell: true
278-
large-packages: true
279-
swap-storage: true
280-
docker-images: true
274+
# - name: Free Disk Space (Ubuntu)
275+
# uses: insightsengineering/disk-space-reclaimer@v1
276+
# with:
277+
# # this might remove tools that are actually needed,
278+
# # if set to "true" but frees about 6 GB
279+
# tools-cache: false
280+
281+
# # all of these default to true, but feel free to set to
282+
# # "false" if necessary for your workflow
283+
# android: false
284+
# dotnet: true
285+
# haskell: true
286+
# large-packages: true
287+
# swap-storage: true
288+
# docker-images: true
281289
- name: Checkout
282290
uses: actions/checkout@v4
283291

@@ -337,8 +345,17 @@ jobs:
337345
adb shell input keyevent 82
338346
./scripts/test-android.sh
339347
340-
test-android-libsql:
348+
- name: Upload Android diagnostics
349+
if: failure()
350+
uses: actions/upload-artifact@v4
351+
with:
352+
name: android-logcat-${{ github.job }}
353+
path: example/android-logcat.txt
354+
if-no-files-found: ignore
355+
356+
android-libsql:
341357
runs-on: ubuntu-latest
358+
timeout-minutes: 40
342359
env:
343360
TURBO_CACHE_DIR: .turbo/android
344361
steps:
@@ -387,3 +404,11 @@ jobs:
387404
adb wait-for-device
388405
adb shell input keyevent 82
389406
./scripts/test-android.sh
407+
408+
- name: Upload Android diagnostics
409+
if: failure()
410+
uses: actions/upload-artifact@v4
411+
with:
412+
name: android-logcat-${{ github.job }}
413+
path: example/android-logcat.txt
414+
if-no-files-found: ignore

cpp/DBHostObject.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,10 +242,11 @@ void DBHostObject::create_jsi_functions(jsi::Runtime &rt) {
242242
thread_pool->waitFinished();
243243
#ifdef OP_SQLITE_USE_LIBSQL
244244
opsqlite_libsql_close(db);
245+
db = {};
245246
#else
246247
opsqlite_close(db);
247-
#endif
248248
db = nullptr;
249+
#endif
249250

250251
return {};
251252
});

cpp/OPThreadPool.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,10 +74,14 @@ void ThreadPool::doWork() {
7474

7575
task = workQueue.front();
7676
workQueue.pop();
77+
++busy;
7778
}
78-
++busy;
7979
task();
80-
--busy;
80+
{
81+
std::lock_guard<std::mutex> g(workQueueMutex);
82+
--busy;
83+
}
84+
workQueueConditionVariable.notify_one();
8185
}
8286
}
8387

example/ios/Podfile.lock

Lines changed: 7 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -25,28 +25,6 @@ PODS:
2525
- ReactCommon/turbomodule/core
2626
- ReactNativeDependencies
2727
- Yoga
28-
- OpServer (0.1.5):
29-
- hermes-engine
30-
- RCTRequired
31-
- RCTTypeSafety
32-
- React-Core
33-
- React-Core-prebuilt
34-
- React-debug
35-
- React-Fabric
36-
- React-featureflags
37-
- React-graphics
38-
- React-ImageManager
39-
- React-jsi
40-
- React-NativeModulesApple
41-
- React-RCTFabric
42-
- React-renderercss
43-
- React-rendererdebug
44-
- React-utils
45-
- ReactCodegen
46-
- ReactCommon/turbomodule/bridging
47-
- ReactCommon/turbomodule/core
48-
- ReactNativeDependencies
49-
- Yoga
5028
- RCTDeprecation (0.82.1)
5129
- RCTRequired (0.82.1)
5230
- RCTTypeSafety (0.82.1):
@@ -1356,7 +1334,7 @@ PODS:
13561334
- ReactNativeDependencies
13571335
- react-native-restart (0.0.27):
13581336
- React-Core
1359-
- react-native-safe-area-context (5.6.2):
1337+
- react-native-safe-area-context (5.7.0):
13601338
- hermes-engine
13611339
- RCTRequired
13621340
- RCTTypeSafety
@@ -1368,8 +1346,8 @@ PODS:
13681346
- React-graphics
13691347
- React-ImageManager
13701348
- React-jsi
1371-
- react-native-safe-area-context/common (= 5.6.2)
1372-
- react-native-safe-area-context/fabric (= 5.6.2)
1349+
- react-native-safe-area-context/common (= 5.7.0)
1350+
- react-native-safe-area-context/fabric (= 5.7.0)
13731351
- React-NativeModulesApple
13741352
- React-RCTFabric
13751353
- React-renderercss
@@ -1380,7 +1358,7 @@ PODS:
13801358
- ReactCommon/turbomodule/core
13811359
- ReactNativeDependencies
13821360
- Yoga
1383-
- react-native-safe-area-context/common (5.6.2):
1361+
- react-native-safe-area-context/common (5.7.0):
13841362
- hermes-engine
13851363
- RCTRequired
13861364
- RCTTypeSafety
@@ -1402,7 +1380,7 @@ PODS:
14021380
- ReactCommon/turbomodule/core
14031381
- ReactNativeDependencies
14041382
- Yoga
1405-
- react-native-safe-area-context/fabric (5.6.2):
1383+
- react-native-safe-area-context/fabric (5.7.0):
14061384
- hermes-engine
14071385
- RCTRequired
14081386
- RCTTypeSafety
@@ -1803,7 +1781,6 @@ DEPENDENCIES:
18031781
- FBLazyVector (from `../node_modules/react-native/Libraries/FBLazyVector`)
18041782
- hermes-engine (from `../node_modules/react-native/sdks/hermes-engine/hermes-engine.podspec`)
18051783
- op-sqlite (from `../..`)
1806-
- "OpServer (from `../node_modules/@op-engineering/op-server`)"
18071784
- RCTDeprecation (from `../node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation`)
18081785
- RCTRequired (from `../node_modules/react-native/Libraries/Required`)
18091786
- RCTTypeSafety (from `../node_modules/react-native/Libraries/TypeSafety`)
@@ -1883,8 +1860,6 @@ EXTERNAL SOURCES:
18831860
:tag: hermes-2025-09-01-RNv0.82.0-265ef62ff3eb7289d17e366664ac0da82303e101
18841861
op-sqlite:
18851862
:path: "../.."
1886-
OpServer:
1887-
:path: "../node_modules/@op-engineering/op-server"
18881863
RCTDeprecation:
18891864
:path: "../node_modules/react-native/ReactApple/Libraries/RCTFoundation/RCTDeprecation"
18901865
RCTRequired:
@@ -2027,8 +2002,7 @@ EXTERNAL SOURCES:
20272002
SPEC CHECKSUMS:
20282003
FBLazyVector: 2e5b5553df729e080483373db6f045201ff4e6db
20292004
hermes-engine: 273e30e7fb618279934b0b95ffab60ecedb7acf5
2030-
op-sqlite: a0d8cbee3fc5f8c8b67272c3b07c3b4f07b5b17f
2031-
OpServer: 9b3ebdeeb095950e760e3c39853cd06849421b35
2005+
op-sqlite: 0e554518f49eb1488f2b42bc166c713c0756f4d3
20322006
RCTDeprecation: c6b36da89aa26090c8684d29c2868dcca2cd4554
20332007
RCTRequired: 1413a0844770d00fa1f1bb2da4680adfa8698065
20342008
RCTTypeSafety: 354b4bb344998550c45d054ef66913837948f958
@@ -2063,7 +2037,7 @@ SPEC CHECKSUMS:
20632037
React-Mapbuffer: b825b19234eb571a071e595c123909f0c15ab8f5
20642038
React-microtasksnativemodule: acf58b8dd297cd84ccff01eeac094c405adcea00
20652039
react-native-restart: 0bc732f4461709022a742bb29bcccf6bbc5b4863
2066-
react-native-safe-area-context: 37e680fc4cace3c0030ee46e8987d24f5d3bdab2
2040+
react-native-safe-area-context: ae7587b95fb580d1800c5b0b2a7bd48c2868e67a
20672041
React-NativeModulesApple: b50b7150a4f573d8466c43d8af38d2610fe17d92
20682042
React-oscompat: 2290ac70fe07fbaba8473c4054084029777c5a22
20692043
React-perflogger: d3b6b00d0e8fe2108069d175f6a51ea58f31c76a

example/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
"ios": "react-native run-ios --scheme='debug' --simulator='iPhone 16 Pro'",
88
"run:ios:unused": "xcodebuild -workspace ios/OPSQLiteExample.xcworkspace -scheme release -configuration Release -sdk iphonesimulator -destination 'platform=iOS Simulator,name=iPhone 16 Pro' clean build",
99
"run:ios:release": "react-native run-ios --scheme='release' --no-packager",
10+
"postinstall": "patch-package",
1011
"start": "react-native start",
1112
"pods": "cd ios && bundle exec pod install && rm -f .xcode.env.local",
1213
"pods:nuke": "cd ios && rm -rf Pods && rm -rf Podfile.lock && bundle exec pod install",
@@ -15,7 +16,6 @@
1516
"build:ios": "cd ios && xcodebuild -workspace OPSQLiteExample.xcworkspace -scheme debug -configuration Debug -sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO"
1617
},
1718
"dependencies": {
18-
"@op-engineering/op-server": "^0.1.5",
1919
"@op-engineering/op-test": "^0.2.5",
2020
"chance": "^1.1.9",
2121
"clsx": "^2.0.0",
@@ -36,6 +36,7 @@
3636
"@react-native/typescript-config": "0.81.5",
3737
"@types/chance": "^1.1.7",
3838
"@types/react": "^19.1.1",
39+
"patch-package": "^8.0.1",
3940
"react-native-builder-bob": "^0.40.13",
4041
"react-native-monorepo-config": "^0.1.9",
4142
"react-native-restart": "^0.0.27",

example/src/App.tsx

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import {useEffect, useState} from 'react';
2-
import {setServerResults, stopServer} from './server';
32
import {
43
displayResults,
54
runTests,
@@ -9,7 +8,7 @@ import './tests'; // import all tests to register them
98
import {SafeAreaProvider, SafeAreaView} from 'react-native-safe-area-context';
109
// import {performanceTest} from './performance_test';
1110
import {StyleSheet, Text, View} from 'react-native';
12-
import {open} from '@op-engineering/op-sqlite';
11+
// import {open} from '@op-engineering/op-sqlite';
1312

1413
export default function App() {
1514
const [results, setResults] = useState<any>(null);
@@ -19,20 +18,22 @@ export default function App() {
1918
useEffect(() => {
2019
console.log("App has started 🟢")
2120
const work = async () => {
22-
let start = performance.now();
23-
open({
24-
name: 'dummyDb.sqlite',
25-
});
26-
setOpenTime(performance.now() - start);
21+
// let start = performance.now();
22+
// open({
23+
// name: 'dummyDb.sqlite',
24+
// });
25+
// setOpenTime(performance.now() - start);
2726

2827
try {
28+
console.log("TESTS STARTED 🟠");
2929
const results = await runTests();
30+
const passed = allTestsPassed(results);
3031
console.log("TESTS FINISHED 🟢")
31-
setServerResults(allTestsPassed(results));
32+
console.log(`OPSQLITE_TEST_RESULT:${passed ? 'PASS' : 'FAIL'}`);
3233
setResults(results);
3334
} catch (e) {
3435
console.log(`TEST FAILED 🟥 ${e}`)
35-
setServerResults(false);
36+
console.log('OPSQLITE_TEST_RESULT:FAIL');
3637
}
3738

3839
// setTimeout(() => {
@@ -48,9 +49,7 @@ export default function App() {
4849

4950
work();
5051

51-
return () => {
52-
stopServer();
53-
};
52+
return () => {};
5453
}, []);
5554

5655
// const shareDb = async () => {

0 commit comments

Comments
 (0)