-
-
Notifications
You must be signed in to change notification settings - Fork 375
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[BUG] internal error: invalid index to get #4902
Comments
I'm not quite sure that coroutines are still working in Rspamd... Last time I have revisited that issue was quite a long time ago - and they were broken at some point. Try to rework it to a generic async call so we can narrow down the issue here. I'm pretty sure it's with coroutines only. |
I've converted it to a callback and haven't seen any crashes, but I don't think it is conclusive yet. After 24h with no crashes it is a very high probability that the issue was fixed, I will update later. Here is what it looks like now: local k_contact_id = rspamd_config:register_symbol{
name = "K_CONTACT",
description = "Sender is in address book",
flags = "nice",
score = -20.0,
callback = function(task)
if task:get_user() then
return
end
local from = task:get_from({"original"})[1].addr
if from:find "[<&]" then
return
end
if not task:has_symbol("DMARC_POLICY_ALLOW") then
rspamd_logger.infox(task, "Not checking contact without DMARC pass.")
return
end
local ok = rspamd_http.request({
task = task,
url = "https://contacts.example/addressbook.dav",
method = "REPORT",
user = "root",
password = dav_pass,
headers = {
depth = 1,
},
body = [[<?xml version="1.0" encoding="utf-8"?>
<addressbook-query xmlns="urn:ietf:params:xml:ns:carddav">
<filter>
<prop-filter name="EMAIL">
<text-match collation="i;unicode-casemap" match-type="equals">]]..from..[[</text-match>
</prop-filter>
</filter>
<limit><nresults>1</nresults></limit>
</addressbook-query>
]],
timeout = 10,
callback = function(err, status, body)
if err then
rspamd_logger.errx(task, "Contact lookup for %s failed %s %s %s", from, err, status, body)
return
end
if status ~= 207 then
rspamd_logger.errx(task, "Unexpected contact lookup response %s %s", status, body)
return
end
local has_contact = body:find " 200 OK</d:status>"
task:insert_result("K_CONTACT", has_contact and 1 or 0, from)
end,
})
if not ok then
rspamd_logger.errx(task, "rspamd_http.request returned false looking up %s", from)
end
end,
}
rspamd_config:register_dependency("K_CONTACT", "DMARC_POLICY_ALLOW") |
It went from crashing 2-8x per day to 0 in the last 24h. So it seems highly likely that the issue is only present on the coroutine version. |
Update: No crashes since, so I'm pretty sure the bug was triggered by the coroutine code. |
Prerequisites
Describe the bug
rspamd frequently crashes when processing messages. It doesn't appear to depend on any specific message but just a random crash rate.
Note: I do have a log with more history however due to the volume and possibility of semi-sensitive data I am not comfortable posting it publicly. However I can share it privately upon request.
Steps to Reproduce
Expected behavior
rspamd doesn't crash.
Versions
Rspamd daemon version 3.8.4
CPU architecture x86_64; features: avx, sse2, sse3, ssse3, sse4.1, sse4.2, rdrand
Hyperscan enabled: TRUE
Jemalloc enabled: TRUE
LuaJIT enabled: TRUE (LuaJIT version: LuaJIT 2.1.1693350652)
ASAN enabled: FALSE
BLAS enabled: FALSE
Fasttext enabled: FALSE
OS: NixOS
This also occurred on 3.8.3 and possibly older versions.
Additional Information
Looking at the logs it looks like this may be related to the insertion of an async symbol.
The
K_CONTACT
symbol is defined like this (slightly redacted):The text was updated successfully, but these errors were encountered: