После установки Symfony 4.1.3 на компьютере под управлением SLES 12.3 с PHP 7.1.20 (и позже обновленным до 7.1.21) дочерние процессы Apache начали сбой сегментации. Это происходит несколько раз в час, казалось бы, случайно.
[Fri Sep 07 09:57:01.166821 2018] [core:notice] [pid 10004:tid 139775548520192] AH00052: child pid 7164 exit signal Segmentation fault (11)
Я не могу различить какой-то конкретный паттерн сумасшествия, только то, что он потенциально может иметь какое-то отношение к взаимодействию Symfony с phpenv (основываясь на дампе ниже).
Общие сведения о назначении этой установки Symfony: используется в качестве обычного приложения CRUD с конечными точками API, которые выплевывают данные JSON. Я использую "friendsofsymfony / rest-bundle": "^ 2.3" для обработки API. Сами конечные точки API довольно просты. Вот пример одного:
public function getExternalRedirectAction(Request $request): Response
{
$url = $request->query->get('url');
$redirect = $this->getDoctrine()->getRepository(Redirect::class)->findOneBy(['fromLink' => $url]);
if (!$redirect) {
$response = new Response(json_encode("The redirect you requested was not found."), 404, array('Content-Type' => 'application/json'));
return $response;
}
$redirect->setVisits($redirect->getVisits() + 1);
$redirect->setLastVisit(new \DateTime());
$em = $this->getDoctrine()->getManager();
$em->persist($redirect);
$em->flush();
$context = new SerializationContext();
$context->setSerializeNull(true);
$serializer = $this->container->get('jms_serializer');
$serialized = $serializer->serialize($redirect, 'json', $context);
$response = new Response($serialized, 200, array('Content-Type' => 'application/json'));
return $response;
}
Вот полная обратная трассировка после ошибки сегмента.
(gdb) backtrace full
#0 0x00007fedcc1162b3 in __strchr_sse2 () from /lib64/libc.so.6
No symbol table info available.
#1 0x00007fedcc0cc0c8 in putenv () from /lib64/libc.so.6
No symbol table info available.
#2 0x00007fedc616a85c in php_putenv_destructor (zv=0x7fed96ad59a0)
at /usr/local/src/php-7.1.21/ext/standard/basic_functions.c:3435
pe = 0x7fed96afaa40
#3 0x00007fedc63afc65 in zend_hash_destroy (ht=0x7fed8c0e4328)
at /usr/local/src/php-7.1.21/Zend/zend_hash.c:1246
p = 0x7fed96ad59a0
end = 0x7fed96ad5a80
#4 0x00007fedc616c467 in zm_deactivate_basic (type=1, module_number=33)
at /usr/local/src/php-7.1.21/ext/standard/basic_functions.c:3811
No locals.
#5 0x00007fedc63a43ad in zend_deactivate_modules ()
at /usr/local/src/php-7.1.21/Zend/zend_API.c:2576
module = 0xdfd070
p = 0xf85808
__orig_bailout = 0x0
__bailout = {{__jmpbuf = {140658233296848, 1066617060162552172,
140658502012712, 140659038370920, 140659038370104,
140659038370752, 1066617060149969260, 1066664924020097388},
__mask_was_saved = 0, __saved_mask = {__val = {
---Type <return> to continue, or q <return> to quit---
1066664949417394540, 140655883976704, 140659220598624,
15867216, 18446744064156967775, 15866640, 77753426461,
140658845055312, 140659209739746, 140658845055344,
140658233298472, 140658845055344, 0, 140658845055328,
140659209527934, 0}}}}
#6 0x00007fedc62d8638 in php_request_shutdown (dummy=0x0)
at /usr/local/src/php-7.1.21/main/main.c:1876
report_memleaks = 1 '\001'
#7 0x00007fedc648d467 in php_apache_request_dtor (r=0x7fed9c0c0f28)
at /usr/local/src/php-7.1.21/sapi/apache2handler/sapi_apache2.c:552
No locals.
#8 0x00007fedc648df8a in php_handler (r=0x7fed9c0c0f28)
at /usr/local/src/php-7.1.21/sapi/apache2handler/sapi_apache2.c:724
ctx = 0x7fed781b6810
conf = 0xd82a70
brigade = 0x7fed9c195330
bucket = 0xdcba00
rv = 0
parent_req = 0x0
#9 0x0000000000455850 in ap_run_handler (r=r@entry=0x7fed9c0c0f28)
at config.c:170
pHook = <optimized out>
n = 5
---Type <return> to continue, or q <return> to quit---
rv = -1
#10 0x0000000000455d99 in ap_invoke_handler (r=r@entry=0x7fed9c0c0f28)
at config.c:444
handler = <optimized out>
p = <optimized out>
result = <optimized out>
old_handler = 0x0
ignore = <optimized out>
#11 0x000000000046aa4c in ap_internal_redirect (new_uri=<optimized out>,
r=<optimized out>) at http_request.c:791
access_status = <optimized out>
new = 0x7fed9c0c0f28
#12 0x00007fedc701d25c in handler_redirect (r=0x7fed9c0c2800)
at mod_rewrite.c:5256
No locals.
#13 0x0000000000455850 in ap_run_handler (r=r@entry=0x7fed9c0c2800)
at config.c:170
pHook = <optimized out>
n = 4
rv = -1
#14 0x0000000000455d99 in ap_invoke_handler (r=r@entry=0x7fed9c0c2800)
at config.c:444
handler = <optimized out>
---Type <return> to continue, or q <return> to quit---
p = <optimized out>
result = <optimized out>
old_handler = 0x7fedc7025e14 "redirect-handler"
ignore = <optimized out>
#15 0x000000000046b6da in ap_process_async_request (r=0x7fed9c0c2800)
at http_request.c:453
access_status = 0
#16 0x0000000000467c51 in ap_process_http_async_connection (c=0x7fedbc043c68)
at http_core.c:154
r = 0x7fed9c0c2800
cs = 0x7fedbc043c30
#17 ap_process_http_connection (c=0x7fedbc043c68) at http_core.c:248
No locals.
#18 0x000000000045f380 in ap_run_process_connection (c=c@entry=0x7fedbc043c68)
at connection.c:42
pHook = <optimized out>
n = 2
rv = -1
#19 0x0000000000472dca in process_socket (thd=<optimized out>,
p=<optimized out>, sock=<optimized out>, cs=0x7fedbc043bc0,
my_child_num=<optimized out>, my_thread_num=<optimized out>)
at event.c:1048
c = 0x7fedbc043c68
---Type <return> to continue, or q <return> to quit---
conn_id = <optimized out>
clogging = <optimized out>
rv = <optimized out>
rc = 0
#20 0x0000000000474348 in worker_thread (thd=0xd23a78, dummy=<optimized out>)
at event.c:2122
csd = 0x7fedbc0439c0
cs = 0x0
te = 0x0
ptrans = 0x7fedbc043938
ti = <optimized out>
process_slot = 3
thread_slot = 24
rv = <optimized out>
is_idle = 0
#21 0x00007fedcc646724 in start_thread () from /lib64/libpthread.so.0
No symbol table info available.
#22 0x00007fedcc181e8d in clone () from /lib64/libc.so.6
No symbol table info available.