aboutsummaryrefslogtreecommitdiffstats
path: root/src/lua/lua_thread_pool.c
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2019-05-24 14:13:13 +0100
committerVsevolod Stakhov <vsevolod@highsecure.ru>2019-05-24 14:13:13 +0100
commiteb5fc65aca905ad38bab0dae85dba0f9a56d7766 (patch)
tree126bf68a7c23e471920f73951ad8cd2326237a5b /src/lua/lua_thread_pool.c
parent8303b194152ffc02b5079b6bd08f1fecfd43f5d0 (diff)
downloadrspamd-eb5fc65aca905ad38bab0dae85dba0f9a56d7766.tar.gz
rspamd-eb5fc65aca905ad38bab0dae85dba0f9a56d7766.zip
[Fix] Do not use lightuserdata for traceback
LuaJIT limits lightuserdata usage to 47 bits. On Arm64, this leads to break of the C <-> Lua interoperability using this type. This rework has changed traceback function behaviour from lightuserdata opaque pointer (GString * in particular) to luaL_Buffer. Issue: #2906
Diffstat (limited to 'src/lua/lua_thread_pool.c')
-rw-r--r--src/lua/lua_thread_pool.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/src/lua/lua_thread_pool.c b/src/lua/lua_thread_pool.c
index 3d289a12e..1fa584c51 100644
--- a/src/lua/lua_thread_pool.c
+++ b/src/lua/lua_thread_pool.c
@@ -278,7 +278,6 @@ lua_resume_thread_internal_full (struct thread_entry *thread_entry,
{
gint ret;
struct lua_thread_pool *pool;
- GString *tb;
struct rspamd_task *task;
msg_debug_lua_threads ("%s: lua_resume_thread_internal_full", loc);
@@ -297,6 +296,7 @@ lua_resume_thread_internal_full (struct thread_entry *thread_entry,
else {
pool = thread_entry->cfg->lua_thread_pool;
}
+
if (ret == 0) {
if (thread_entry->finish_callback) {
thread_entry->finish_callback (thread_entry, ret);
@@ -304,21 +304,21 @@ lua_resume_thread_internal_full (struct thread_entry *thread_entry,
lua_thread_pool_return_full (pool, thread_entry, loc);
}
else {
- tb = rspamd_lua_get_traceback_string (thread_entry->lua_state);
- if (tb && thread_entry->error_callback) {
- thread_entry->error_callback (thread_entry, ret, tb->str);
+ rspamd_lua_traceback (thread_entry->lua_state);
+ if (thread_entry->error_callback) {
+ thread_entry->error_callback (thread_entry, ret,
+ lua_tostring (thread_entry->lua_state, -1));
}
else if (thread_entry->task) {
task = thread_entry->task;
- msg_err_task ("lua call failed (%d): %v", ret, tb);
+ msg_err_task ("lua call failed (%d): %s", ret,
+ lua_tostring (thread_entry->lua_state, -1));
}
else {
- msg_err ("lua call failed (%d): %v", ret, tb);
+ msg_err ("lua call failed (%d): %s", ret,
+ lua_tostring (thread_entry->lua_state, -1));
}
- if (tb) {
- g_string_free (tb, TRUE);
- }
/*
* Maybe there is a way to recover here.
* For now, just remove faulty thread