call to close causing Segmentation fault

Ask a Question related to UNIX Programming, Design and Development.

  1. #1

    Default call to close causing Segmentation fault

    I'm calling close on a valid file descriptor, I've added a check with
    select to make sure the file descriptor is valid, and it is causing a
    Segmentation fault.
    Whenever I comment out the call to close I no longer get the
    Segmentation fault. The code uses SSL to open the connect and the
    problem occurs right after a call to
    SSL_read fails. The wierd thing is it doesn't cause the Segmentation
    fault right away. It first returns from the function calling the
    close() and prints a message then the
    Segmentation fault happens. I know it is the close that is doing it
    though because the Segmentation fault goes away when I comment out the
    close() call.

    Anybody every come accross something like this?

    Liam

    Liam Darragh Whalen Guest

  2. Similar Questions and Discussions

    1. #17281 [Com]: session_encode is causing segmentation fault
      ID: 17281 Comment by: miguelangel dot gonzalez at itesm dot mx Reported By: rubens_gomes at hotmail dot com Status: ...
    2. #26020 [Opn->Bgs]: preg_replace causing segmentation fault
      ID: 26020 Updated by: sniper@php.net Reported By: coldrain at workingonit dot org -Status: Open +Status: ...
    3. #26020 [Fbk->Opn]: preg_replace causing segmentation fault
      ID: 26020 User updated by: coldrain at workingonit dot org Reported By: coldrain at workingonit dot org -Status: ...
    4. #26020 [Opn]: preg_replace causing segmentation fault
      ID: 26020 User updated by: coldrain at workingonit dot org Reported By: coldrain at workingonit dot org Status: Open...
    5. #26020 [NEW]: preg_replace causing segmentation fault
      From: coldrain at workingonit dot org Operating system: Linux PHP version: Irrelevant PHP Bug Type: PCRE related Bug...
  3. #2

    Default Re: call to close causing Segmentation fault

    Liam Darragh Whalen <lwhalen@cabletv.on.ca> wrote:
    > I'm calling close on a valid file descriptor, I've added a check with
    > select to make sure the file descriptor is valid, and it is causing a
    > Segmentation fault.
    > Whenever I comment out the call to close I no longer get the
    > Segmentation fault. The code uses SSL to open the connect and the
    > problem occurs right after a call to
    > SSL_read fails. The wierd thing is it doesn't cause the Segmentation
    > fault right away. It first returns from the function calling the
    > close() and prints a message then the
    > Segmentation fault happens. I know it is the close that is doing it
    > though because the Segmentation fault goes away when I comment out the
    > close() call.
    Probably the segmentation fault has really nothing to do with the
    close() call but some memory corruption happening somewhere else
    in your program. You probably have written past the end of an array
    or to memory locations that have not been allocated to your process.
    This often leads to segfaults at seemingly random and unrelated places,
    e.g. in some libc function calls. I would recommend to get a memory
    checker (valgrind, purify or one of the many other) and/or switching
    on the memory checker build into newer glibc's (if you have it) by
    compiling with the -DLIBC_MDEBUG flag.
    Regards, Jens
    --
    _ _____ _____
    | ||_ _||_ _| [email]Jens.Toerring@physik.fu-berlin.de[/email]
    _ | | | | | |
    | |_| | | | | | [url]http://www.physik.fu-berlin.de/~toerring[/url]
    \___/ens|_|homs|_|oerring
    Jens.Toerring@physik.fu-berlin.de Guest

  4. #3

    Default Re: call to close causing Segmentation fault


    "Liam Darragh Whalen" <lwhalen@cabletv.on.ca> wrote in message
    news:3F03D58B.71E3BA62@cabletv.on.ca...
    > I'm calling close on a valid file descriptor, I've added a check with
    > select to make sure the file descriptor is valid, and it is causing a
    > Segmentation fault.
    Troubleshoot! Compile with symbols, get a core dump, run 'gdb'.

    DS


    David Schwartz Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139