GitHub user zizhong opened a pull request:
https://github.com/apache/trafficserver/pull/1457
fix TS-4195: crash when stop trafficserver
Because of `psiginfo`, `psignal` and `exit`, which call `malloc` and `free`
inside `proxy_signal_handler`. ATS will crash from time to time when stop.
> A signal handler can be called at any time, including during times when
another call to malloc is in progress. If this happens, one of two things will
occur:
>
> Your process will deadlock inside the signal handler, because malloc will
be unable to acquire the heap lock.
> Your process will corrupt its heap, because malloc does acquire the lock
(or doesn't think it needs it), then proceeds to render the heap inconsistent,
leading to a later crash.
From
[here](http://stackoverflow.com/questions/3366307/why-is-malloc-not-async-signal-safe)
Tested with a script repeating starting and stopping ATS on RHEL 6.6, the
current master crashes after about 2~10 times. This patch doesn't crash after
6k+ tries.
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/zizhong/trafficserver TS-4195
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/trafficserver/pull/1457.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #1457
----
commit 8a9365aebd0eaa3a9fd451703996060c869fa7f5
Author: Zizhong Zhang <[email protected]>
Date: 2017-02-16T18:03:15Z
fix TS-4195: double free when stop trafficserver
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---