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

Workaround for os-squid SIGSEGV #4500

Open
kravietz opened this issue Jan 24, 2025 · 2 comments
Open

Workaround for os-squid SIGSEGV #4500

kravietz opened this issue Jan 24, 2025 · 2 comments

Comments

@kravietz
Copy link

Important notices
Before you add a new report, we ask you kindly to acknowledge the following:

Describe the bug
The Squid service crashes with SIGSEGV when trying to shut it down using its "native" squid -k shutdown command, resulting in Squid process persisting in memory and not really shutting down. This also renders all service restart attempts ineffective. This incorrect behaviour only happens when using the -k shutdown command, but sending it SIGTERM results in a proper shutdown.

To Reproduce
Run service squid stop, watch the logs:

<13>1 2025-01-24T12:03:01+00:00 hostname kernel - - [meta sequenceId="2"] <6>pid 68937 (squid), jid 0, uid 100: exited on signal 11 (no core dump - bad address)

But if you then check ps axuw|grep squid and the Squid process will be still resident in memory.

Expected behavior
The bug can be easily mitigated by commenting out the stop_precmd definition from /usr/local/etc/rc.d/squid which will revert it to the native FreeBSD behaviour of sending SIGTERM, to which Squid surprisingly responds with proper shutdown:

...
start_postcmd=squid_getpid
#stop_precmd=squid_prestop
configtest_cmd=squid_configtest
...

The stop_precmd workaround works for me, but if it wouldn't then there's two more options to clean up the Squid process:

  • sig_stop="KILL"
  • stop_postcmd="pkill -9 squid"

Please note that because the Squid service script uses squid_prestop which crashes on SIGSEGV, the script is abruptly terminated and does not continue to the stop phase. This will render the above options useless as long the original squid_prestop remains in place.

Additional context
This was first reported and should mitigate this bug: #3827

Environment

  • OPNsense 24.7.12_2 (amd64)
  • os-squid 1.1_1
  • squid 6.12
@fichtner
Copy link
Member

For the FreeBSD port that seems to be standard behaviour:

squid_prestop()                                                                 
{                                                                               
    command_args="$command_args -k shutdown"                                
    squid_configtest                                                        
}  

Overriding stop_precmd is not possible from our end.

@kravietz
Copy link
Author

@fichtner Yes, it is standard behaviour that causes SIGSEGV. Created freebsd/freebsd-ports#339 for upstream fix.

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

No branches or pull requests

2 participants