Skip to content

PHP crash after:[ error ] [2]imap_open(): Couldn't open stream #10895

Closed as not planned

Description

@kinghuaq

From manual page: https://php.net/function.imap-open

Guys, I encountered a problem, I open "{imap.exmail.qq.com:143}INBOX" every 5 minutes, at least failed one time in 24 hours, it shows "[ error ] [2]imap_open(): Couldn't open stream {imap.exmail.qq.com:143}INBOX", and PHP crashed, ended by "WARNING: [pool www] child 236893 exited on signal 11 (SIGSEGV - core dumped) after 58173.740387 seconds from started".
I want to catch the error by try {}catch(){}, but not work, it is seems imap.so will not recover after opening error. My PHP version is 7.0.
I don't want PHP crash, I want PHP keep running after failed, is any way to do this? thank you very much!


Activity

  1. transferred this issue fromphp/doc-enon Mar 21, 2023
  2. damianwadley commented on Mar 21, 2023

    @damianwadley
    Member

    Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php for *NIX and http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32.

    Once you have generated a backtrace, please submit it to this bug report and the status will change back to "Open".

  3. github-actions commented on Apr 5, 2023

    @github-actions

    No feedback was provided. The issue is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so. Thank you.

  4. kinghuaq commented on May 12, 2023

    @kinghuaq
    Author

    Hello Damian,
    Sorry for late reply because I am focusing on other things.
    I attached the corefile and below is the bt.
    Thank you very much!

    bash-root_@localhost-JP[/www/wwwroot/www.tchaintech.com]
    ==> gdb /www/server/php/70/sbin/php-fpm /www/wwwroot/corefiles/core-php-fpm.744042
    GNU gdb (Ubuntu 9.2-0ubuntu1~20.04.1) 9.2
    Copyright (C) 2020 Free Software Foundation, Inc.
    
    License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
    This is free software: you are free to change and redistribute it.
    There is NO WARRANTY, to the extent permitted by law.
    Type "show copying" and "show warranty" for details.
    This GDB was configured as "x86_64-linux-gnu".
    Type "show configuration" for configuration details.
    For bug reporting instructions, please see:
    <http://www.gnu.org/software/gdb/bugs/>.
    Find the GDB manual and other documentation resources online at:
        <http://www.gnu.org/software/gdb/documentation/>.
    
    For help, type "help".
    Type "apropos word" to search for commands related to "word"...
    Reading symbols from /www/server/php/70/sbin/php-fpm...
    [New LWP 744042]
    
    warning: Section `.reg-xstate/744042' in core file too small.
    [Thread debugging using libthread_db enabled]
    Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
    Core was generated by `php-fpm: pool www                                                             '.
    Program terminated with signal SIGSEGV, Segmentation fault.
    
    warning: Section `.reg-xstate/744042' in core file too small.
    #0  zend_mm_alloc_small (bin_num=0, size=0, heap=0x7faad7600040) at /www/server/php/70/src/Zend/zend_alloc.c:1318
    1318    /www/server/php/70/src/Zend/zend_alloc.c: No such file or directory.
    (gdb) bt
    #0  zend_mm_alloc_small (bin_num=0, size=0, heap=0x7faad7600040) at /www/server/php/70/src/Zend/zend_alloc.c:1318
    #1  zend_mm_alloc_heap (size=0, heap=0x7faad7600040) at /www/server/php/70/src/Zend/zend_alloc.c:1389
    #2  _emalloc (size=0) at /www/server/php/70/src/Zend/zend_alloc.c:2477
    #3  0x000056548e49c7c4 in i_init_code_execute_data (return_value=0x7faad7614da0, op_array=0x7faad77c3000, execute_data=0x7faad7614dd0)
        at /www/server/php/70/src/Zend/zend_execute.c:2211
    #4  ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER () at /www/server/php/70/src/Zend/zend_vm_execute.h:3701
    #5  0x000056548e455243 in execute_ex (ex=<optimized out>) at /www/server/php/70/src/Zend/zend_vm_execute.h:414
    #6  0x000056548e49f4e5 in zend_execute (op_array=op_array@entry=0x7faad767a000, return_value=return_value@entry=0x7faad771c080)
        at /www/server/php/70/src/Zend/zend_vm_execute.h:458
    #7  0x000056548e41617c in zend_execute_scripts (type=type@entry=8, retval=0x7faad771c080, retval@entry=0x0, file_count=-681489120,
        file_count@entry=3) at /www/server/php/70/src/Zend/zend.c:1445
    #8  0x000056548e3b87a0 in php_execute_script (primary_file=<optimized out>) at /www/server/php/70/src/main/main.c:2516
    #9  0x000056548dff3dd9 in main (argc=<optimized out>, argv=<optimized out>) at /www/server/php/70/src/sapi/fpm/fpm/fpm_main.c:1967
    
  5. TimWolla commented on May 12, 2023

    @TimWolla
    Member

    @kinghuaq You should never upload or publish your coredumps in a public location, because they contain the full memory contents at the time of crash. This can include passwords, private keys or personally-identifying information. I've removed the links from your comment, but the links may still be in inboxes of users that receive email notifications. You should check if it is necessary to revoke keys or passwords.

    Please keep the original coredumps somewhere on your system, though in case a developer needs you to obtain additional information using gdb.

  6. kinghuaq commented on May 12, 2023

    @kinghuaq
    Author

    Hello TimWolla,

    Thanks very much for your reminding.

  7. kinghuaq commented on May 12, 2023

    @kinghuaq
    Author

    BTW, for this imap_open error, I can't catch it, if I can catch the error, then my php server will not crash.

  8. kinghuaq commented on Jul 28, 2023

    @kinghuaq
    Author

    Dear TimWolla
    How are you?
    Everytime when the mail connect failed, my php server will crash, and I can't catch the error which cause the crash. Could you tell me a way how to catch the crash and prevent my php server down?

    Thanks very much!
    Edward

  9. Girgias commented on Dec 5, 2023

    @Girgias
    Member

    I am going to close this as we are unbundling ext/imap

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions