Skip to content
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

Relay eventually times out all events when using a writePolicy plugin #112

Open
jb55 opened this issue Jul 11, 2024 · 3 comments
Open

Relay eventually times out all events when using a writePolicy plugin #112

jb55 opened this issue Jul 11, 2024 · 3 comments

Comments

@jb55
Copy link
Contributor

jb55 commented Jul 11, 2024

at first I thought this was some resource exhaustion in an efficient script I was using, so I rewrote my plugins in rust, but still after awhile the relay eventually just times out all incoming notes. I am looking through the plugin code and don't see anything obvious where it could go wrong 🤔

for now I have to pkill strfry every hour to fix it, but its definitely not ideal

@jb55 jb55 changed the title Relay eventually rejects all events when using a writePolicy plugin Relay eventually times out all events when using a writePolicy plugin Jul 11, 2024
@hoytech
Copy link
Owner

hoytech commented Jul 19, 2024

The most likely explanation I can think of is that the plugin isn't responding to a particular event, or its response is malformed somehow. Are there any possible failure conditions in your plugin that would prevent a response from being delivered?

Around when it locks up do you see any logs like Got unparseable line from write policy plugin or maybe id mismatch? I'm going to try to think of any extra logging I can add. Having a timeout at the plugin-level is possible too, but it's slightly annoying to code up because I'm using a blocking fgets() call right now.

noteguard looks pretty sweet BTW!

@jb55
Copy link
Contributor Author

jb55 commented Jul 19, 2024 via email

@hoytech
Copy link
Owner

hoytech commented Jul 21, 2024

I'm not sure TBH. I setup noteguard and it's passing all my basic testing. The buffering is correct and I can't see any obvious error cases that would de-sync the stream.

So, I made a debugging script: https://github.com/hoytech/strfry/blob/master/scripts/plugin-debug.pl

Can you please try this? You need the JSON::XS perl package (libjson-xs-perl on Debian-like distros, usually packaged elsewhere too). After it's installed, set this as the relay.writePolicy.plugin param in strfry.conf (paths are probably different):

plugin = "cd /home/user/noteguard && /home/user/strfry/scripts/plugin-debug.pl ./target/debug/noteguard"`

It detects some obvious problems, like mismatched ID, undecodeable JSON, etc. It also times out if it doesn't get a response, by default after 5 seconds. This will restart the plugin, so hopefully you won't need to pkill every hour anymore!

After it's running a while, check the strfry logs for lines starting with PLUGIN-DEBUG. Hopefully this will reveal something!

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants