Hi all,
I am developing a simple modules that embed SQLitein Redis.
The single thread modules works, I won't say that it is ready but it works.
github.com/siscia/rediSQLSince SQLite support multithread I am trying to use that capability on the module.
However I found that while executing at the same time both redis-benchmark and some SQL statements via my own modules everything breaks and I get a segmentation fault.
If I execute only the SQL statements, everything works just fine.
If I execute the SQL statements and I play around with the redis-cli everything works.
Only the combination of SQL statements and redis-benchmark break the multithread module.
Usually the segmentation fault is generated by some free of memory done too early or by some access out of bound.
If it was some out of bound array I believe it would affect also the scenario where I execute only the SQL statements.
What I am left with is some too early free of memory, however I simply never use the keyword RedisModule_Free or free in all my code.
What else can cause a segmentation fault?
What the module does is quite simple, it receive a query, block the client and spawn a new pthread where the query it is executed.
If the query returns some data (think a select against a delete or an update) it memorize all the data in another data structure; when the query is over it unblock the client, loops through the data structure and return a nested array.
Then I do not free this data structure but I just keep it in memory.
The SQL statements are generated by a python script in a single thread way.
Where should I look?
I can definitily share the source of the module if it helps.
Cheers,
Simone