Skip to content

Commit 4173742

Browse files
committed
Replace read lock of DagLocalContext with write lock (as the DagLocalContext dict is not thread safe for reading operations)
1 parent b0ea914 commit 4173742

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/run_info.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,8 @@ void RAI_ContextReadLock(RedisAI_RunInfo *rinfo) {
179179
if (rinfo->single_op_dag || rinfo->single_device_dag) {
180180
return;
181181
}
182-
pthread_rwlock_rdlock(rinfo->dagLock);
182+
// This is a temporary solution
183+
pthread_rwlock_wrlock(rinfo->dagLock);
183184
}
184185

185186
void RAI_ContextWriteLock(RedisAI_RunInfo *rinfo) {

tests/flow/tests_llapi.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,11 @@ def wrapper(env, *args, **kwargs):
2121
try:
2222
ret = con.execute_command('MODULE', 'LOAD', TEST_MODULE_PATH)
2323
env.assertEqual(ret, b'OK')
24-
return f(env, *args, **kwargs)
2524
except Exception as e:
2625
env.assertFalse(True)
2726
env.debugPrint(str(e), force=True)
2827
return
28+
return f(env, *args, **kwargs)
2929
return wrapper
3030

3131

@@ -106,7 +106,7 @@ def test_dag_build_and_run(env):
106106

107107

108108
@ensure_test_module_loaded
109-
def test_llapi_dagrun_multidevice_resnet(env):
109+
def test_dagrun_multidevice_resnet(env):
110110
con = env.getConnection()
111111

112112
model_name_0 = 'imagenet_model1:{{1}}'

0 commit comments

Comments
 (0)