ASF Bugzilla – Attachment 33685 Details for
Bug 59184
mod_jk segmentation fault at jk_shm.c:875
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Fall back to process local memory to avoid crash when shm init failed
mod_jk_shm_open_fail_crashes-bz59184.patch (text/plain), 1.71 KB, created by
Rainer Jung
on 2016-03-20 11:20:34 UTC
(
hide
)
Description:
Fall back to process local memory to avoid crash when shm init failed
Filename:
MIME Type:
Creator:
Rainer Jung
Created:
2016-03-20 11:20:34 UTC
Size:
1.71 KB
patch
obsolete
>Index: common/jk_shm.c >=================================================================== >--- common/jk_shm.c (revision 1735136) >+++ common/jk_shm.c (working copy) >@@ -88,6 +88,10 @@ > #endif > static int jk_shm_inited_cs = 0; > >+/* Used if shared memory fails, fall back ro process local memory */ >+static volatile unsigned int maintain_checking; >+static volatile time_t maintain_time; >+ > static size_t jk_shm_calculate_slot_size() > { > int align = 64; >@@ -872,17 +876,25 @@ > int jk_shm_check_maintain(time_t trigger) > { > int rv = JK_FALSE; >- int maintain_checking = JK_ATOMIC_INCREMENT(&(jk_shmem.hdr->h.data.maintain_checking)); >+ volatile unsigned int *maintain_checking_ptr; >+ volatile time_t *maintain_time_ptr; >+ if (jk_shmem.hdr) { >+ maintain_checking_ptr = &(jk_shmem.hdr->h.data.maintain_checking); >+ maintain_time_ptr = &(jk_shmem.hdr->h.data.maintain_time); >+ } else { >+ maintain_checking_ptr = &maintain_checking; >+ maintain_time_ptr = &maintain_time; >+ } > /* Another process (or thread) is already checking */ >- if (maintain_checking > 1) { >- JK_ATOMIC_DECREMENT(&(jk_shmem.hdr->h.data.maintain_checking)); >+ if (JK_ATOMIC_INCREMENT(maintain_checking_ptr) > 1) { >+ JK_ATOMIC_DECREMENT(maintain_checking_ptr); > return rv; > } >- if (jk_shmem.hdr->h.data.maintain_time < trigger) { >- jk_shmem.hdr->h.data.maintain_time = time(NULL); >+ if (*maintain_time_ptr < trigger) { >+ *maintain_time_ptr = time(NULL); > rv = JK_TRUE; > } >- JK_ATOMIC_DECREMENT(&(jk_shmem.hdr->h.data.maintain_checking)); >+ JK_ATOMIC_DECREMENT(maintain_checking_ptr); > return rv; > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 59184
:
33676
|
33677
|
33678
|
33679
|
33680
| 33685