flock() error after upgrading
-
Drop to a shell and run
tail -F /var/log/nginx.log
and watch a bit and see what is hittingxmlrpc.php
and trace back from there. You could also grep through the older log entries to see.You can also look at / search the log from the GUI (Status > System Logs, System tab, GUI Service sub-tab), but doing so can be tricky since accessing the GUI will add more entries to the log potentially pushing the older entries off.
-
@blathierry said in flock() error after upgrading:
@jimp I use the home assistant integration and uptime kuma. Is that causing it?
Interesting! I use the HA Integration also!
But from my understanding the integration polls the status every 30 seconds. The error seems to occur more often than every 30 seconds. -
I note that code saw updates as recently as today. Are you running the current version?
-
Anyone hitting this, try installing the System Patches package and then create an entry for
053f60e56d09ba711af245c7f0ce6a06673ccc89
to apply the fix.Or apply this diff/change by hand:
diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index f838f6b540..2636fb4aec 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -169,12 +169,13 @@ function try_lock($lock, $timeout = 5) { } /* unlock configuration file */ -function unlock($cfglckkey = 0) { - if (!is_null($cfglckkey)) { - @flock($cfglckkey, LOCK_UN); - @fclose($cfglckkey); - } - return; +function unlock($cfglckkey = 0) +{ + if (!is_resource($cfglckkey)) + return; + + flock($cfglckkey, LOCK_UN); + fclose($cfglckkey); } /* unlock forcefully configuration file */
-
Thanks for looking further into this, needed a break from messing around, will test this later and I completely forgot about the home assistant project I was looking into, will test this soon as I can
-
@stephenw10 Yeah, newest version still does it sadly. I updated both of them. I disabled the home assistant integration for now.. I hope the maintainer will fix it soon, it's very unexpected.
-
Try the diff above. What the HA integration is doing should work with that. They are just hitting a code path that pfSense never normally does. It isn't necessarily wrong, something that needs updating.
-
I spun up a Home Assistant VM, setup HACS and added the pfSense integration. Pointed it at a 23.01 install and immediately saw the errors in question. Applied the lock patch above and haven't seen a single error since.
Looks good to me. It should be in the next build.
-
Nice.
-
Posting this message on the RC build and no error spam, thank you again for looking into this
Home assistant integration currently disabled but not super important so will check out the fix soon
-
@jimp I upgraded pfSense to 23.01.r.20230207.0600 and enabled the integration in Home Assistant and it completely works, no errors at all anymore. Thanks a lot for looking into this and fixing it! I guess we can close this issue now :).
-
-
-