Possible bug in cscli decisions list
Hello crowdsec developers.
When I execute cscli decisions list -l 100 - it works
When I execute cscli decisions list -l 221 - it works
When I execute cscli decisions list -l 0 - it works
When I execute cscli decisions list -l 222 - it hangs forever even for higher numbers
@blotus can this be possible bug ?
For version 1.6.5, after upgrade to 1.6.9 still happening
16 Replies
Important Information
Thank you for getting in touch with your support request. To expedite a swift resolution, could you kindly provide the following information? Rest assured, we will respond promptly, and we greatly appreciate your patience. While you wait, please check the links below to see if this issue has been previously addressed. If you have managed to resolve it, please use run the command
/resolve
or press the green resolve button below.Log Files
If you possess any log files that you believe could be beneficial, please include them at this time. By default, CrowdSec logs to /var/log/, where you will discover a corresponding log file for each component.
Guide Followed (CrowdSec Official)
If you have diligently followed one of our guides and hit a roadblock, please share the guide with us. This will help us assess if any adjustments are necessary to assist you further.
Screenshots
Please forward any screenshots depicting errors you encounter. Your visuals will provide us with a clear view of the issues you are facing.
© Created By WhyAydan for CrowdSec ❤️
how many local decisions do you have ? (
-l 0 -o raw | wc -l
)118
If i had to guess, I'd say a small off-by-one issue in the pagination code when you limit the number of decisions to the exact amount you have
hmmm
so maybe not that
does not matter of the output type. Also I have postgres 13 in case it can matter
yeah the output format is handled client side
it's most likely something to do with the DB query
I can upgrade postgres to higher version and let you know whether it disappear
you can try, but I don't think it will change anything (and postgres 13 is EOL in a few months, so it cannot hurt :D)
you can try to set
db.log_level
to debug
in /etc/crowdsec/config.yaml
, crowdsec will log all queries (so it's very verbose), but we could see if a query seems to be repeated forever (you'll likely want to send the log file in private, it might contain some sensitive data like bouncers IPs or hash of their API key)@blotus you were right, it keeps repeating over and over same query
can you paste the query ? (it should not have anything sensitive in it)
I think i understand the issue, i'll try to reproduce it
Fantastic, thanks a lot. Its not really problem for me, but wanted to let you know in case it might cause another issues in future
i think it can only be triggered by some special limit values, so we should be safe
GitHub
Fix infinite loop in decisions list for some values of limit by blo...
We were checking if len(ret) (the number of decisions that we will return) was equal to 0, instead of checked the actual amount of rows returned from the database (len(result)), which would prevent...
Fantastic, thanks a lot @blotus