Professional Web Applications Themes

C-Language MySQL API and Dying Processes - MySQL

I'd like to write CGI-BIN compiled 'C' programs that use the MySQL 'C' API. However, I'm concerned about dying processes. If a process segfaults or otherwise dies unexpectedly: a)Does the MySQL connection close automatically? b)Do table locks release automatically? Thanks, Dave....

  1. #1

    Default C-Language MySQL API and Dying Processes

    I'd like to write CGI-BIN compiled 'C' programs that use the MySQL 'C' API.

    However, I'm concerned about dying processes. If a process segfaults or
    otherwise dies unexpectedly:

    a)Does the MySQL connection close automatically?

    b)Do table locks release automatically?

    Thanks, Dave.



    David Guest

  2. #2

    Default Re: C-Language MySQL API and Dying Processes

    "David T. Ashley" <com> wrote: 

    Table locks are released automatically if the connection terminates.

    A client connection will be terminated by the following events:

    1. when the client closes the connection explicitly
    2. when the TCP connection to the server is closed
    3. after connect_timeout seconds without any client action
    (connect_timeout is configurable in my.cnf, default: 12 hours)
    4. when somebody explicitly kills the thread in the MySQL server

    In *most* cases the operating system will close the TCP connection(s)
    for dying processes. In fact I haven't witnessed other behaviour.
    But this may be pure luck.


    XL
    --
    Axel Schwenke, Senior Software Developer, MySQL AB

    Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
    MySQL User Forums: http://forums.mysql.com/
    Axel Guest

  3. #3

    Default Re: C-Language MySQL API and Dying Processes

    "Axel Schwenke" <de> wrote in message
    news:homelinux.org... 

    Thanks.

    My experimentation seems to hint at the same behavior.

    Just one more question ...

    In reading the MySQL doentation, it isn't clear to me what the difference
    between the standard library and the "embedded" library are.

    <BEGIN QUESTION>
    What is the "embedded" library?
    <END QUESTION>

    An "embedded" (no server) library would seem to be impossible because only
    the MySQL daemon can get at the MySQL database files involved.

    I'm thinking the standard library is what I want because if the process
    dies, the TCP connection closes, and the MySQL daemon cleans up everything.

    Thanks.



    David Guest

  4. #4

    Default Re: C-Language MySQL API and Dying Processes

    "David T. Ashley" <com> wrote:
     

    I guess you mean the embedded server. This is the MySQL server in form
    of a library. You link you programm against libmysqld. Soon after your
    program starts, you call mysql_server_init() to start the embedded
    server (running as subthread of your program now). You can access this
    embedded server just like the external server (the API functions are
    overloaded in libmysqld).

    However this does not work if you have several instances of your
    program running at the same time; i.e. if your program is a CGI app.


    XL
    --
    Axel Schwenke, Senior Software Developer, MySQL AB

    Online User Manual: http://dev.mysql.com/doc/refman/5.0/en/
    MySQL User Forums: http://forums.mysql.com/
    Axel Guest

Similar Threads

  1. Replies: 6
    Last Post: November 12th, 07:34 PM
  2. Replies: 0
    Last Post: August 12th, 02:26 PM
  3. Replies: 0
    Last Post: August 12th, 12:04 PM
  4. Replies: 0
    Last Post: August 5th, 10:09 PM
  5. asp.net mysql sleeping processes
    By jan nielsen in forum ASP.NET General
    Replies: 0
    Last Post: July 23rd, 12:40 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not 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