#488 The use of palloc in gtm/gtm_proxy will cause a crash at some situation

1.2 Dev Q
open
nobody
None
5
2014-08-01
2014-07-31
peace zone
No

reproduce Step:
1. set the "log_min_messages = DEUBG5" in gtm_proxy.conf -- DEUBG5 not DEBUG5
2. gtm_proxy -D gtm_proxy.conf

stack info:
Program terminated with signal 11, Segmentation fault.

0 0x00000000004131d1 in initStringInfo (str=0x7fffffffdde0) at stringinfo.c:89

89 str->data = (char *) palloc(size);
Missing separate debuginfos, use: debuginfo-install glibc-2.17-55.el7.x86_64
(gdb) b
Breakpoint 1 at 0x4131d1: file stringinfo.c, line 89.
(gdb) bt

0 0x00000000004131d1 in initStringInfo (str=0x7fffffffdde0) at stringinfo.c:89

1 0x00000000004182d1 in config_enum_get_options (record=0x636380 <ConfigureNamesEnum>, prefix=0x42bb59 "Available values: ", suffix=0x42bb57 ".",

separator=0x42bb54 ", ") at gtm_opt_handler.c:1853

2 0x00000000004196d3 in set_config_option (name=0x63cba0 "log_min_messages", value=0x63cbc0 "DEUBG5", context=GTMC_STARTUP, source=GTMC_S_FILE,

changeVal=0 '\000') at gtm_opt_handler.c:2529

3 0x0000000000415d4a in ProcessConfigFile (context=GTMC_STARTUP) at gtm_opt_handler.c:202

4 0x0000000000417923 in SelectConfigFiles (userDoption=0x638140 "/data/pgxc/nodes/gtm_pxy", progname=0x42cba0 "gtm_proxy") at gtm_opt_handler.c:1441

5 0x0000000000421d50 in main (argc=3, argv=0x7fffffffe1d8) at proxy_main.c:687

Apparently the use of palloc causes the core dump, there is no MemoryContext in gtm/gtm_proxy.

Related

Bugs: #488

Discussion

  • Pavan Deolasee
    Pavan Deolasee
    2014-08-01

    Thanks for the report. ISTM that we should create the memory context before we start processing the config file. As this example shows, set_config_option() may try to palloc memory which will fail if the memory context is not up. I propose attached patch. Please try and let us know.

     
    • peace zone
      peace zone
      2014-08-04

      I have merged your code, and it works well.

       
    • Koichi Suzuki
      Koichi Suzuki
      2014-08-04

      Sorry, I couldn't find the patch.

      Koichi Suzuki

      2014-08-01 16:09 GMT+09:00 Pavan Deolasee pavanvd@users.sf.net:

      Thanks for the report. ISTM that we should create the memory context before
      we start processing the config file. As this example shows,
      set_config_option() may try to palloc memory which will fail if the memory
      context is not up. I propose attached patch. Please try and let us know.

      Attachment: xc_move_context_init.patch (3.8 kB; application/octet-stream)


      [bugs:#488] The use of palloc in gtm/gtm_proxy will cause a crash at some
      situation

      Status: open
      Group: 1.2 Dev Q
      Created: Thu Jul 31, 2014 09:05 AM UTC by peace zone
      Last Updated: Thu Jul 31, 2014 09:05 AM UTC
      Owner: nobody

      reproduce Step:
      1. set the "log_min_messages = DEUBG5" in gtm_proxy.conf -- DEUBG5 not
      DEBUG5
      2. gtm_proxy -D gtm_proxy.conf

      stack info:
      Program terminated with signal 11, Segmentation fault.

      0 0x00000000004131d1 in initStringInfo (str=0x7fffffffdde0) at
      stringinfo.c:89

      89 str->data = (char *) palloc(size);
      Missing separate debuginfos, use: debuginfo-install glibc-2.17-55.el7.x86_64
      (gdb) b
      Breakpoint 1 at 0x4131d1: file stringinfo.c, line 89.
      (gdb) bt

      0 0x00000000004131d1 in initStringInfo (str=0x7fffffffdde0) at
      stringinfo.c:89

      1 0x00000000004182d1 in config_enum_get_options (record=0x636380
      <ConfigureNamesEnum>, prefix=0x42bb59 "Available values: ", suffix=0x42bb57
      ".",

      separator=0x42bb54 ", ") at gtm_opt_handler.c:1853

      2 0x00000000004196d3 in set_config_option (name=0x63cba0 "log_min_messages",
      value=0x63cbc0 "DEUBG5", context=GTMC_STARTUP, source=GTMC_S_FILE,

      changeVal=0 '\000') at gtm_opt_handler.c:2529

      3 0x0000000000415d4a in ProcessConfigFile (context=GTMC_STARTUP) at
      gtm_opt_handler.c:202

      4 0x0000000000417923 in SelectConfigFiles (userDoption=0x638140
      "/data/pgxc/nodes/gtm_pxy", progname=0x42cba0 "gtm_proxy") at
      gtm_opt_handler.c:1441

      5 0x0000000000421d50 in main (argc=3, argv=0x7fffffffe1d8) at
      proxy_main.c:687

      Apparently the use of palloc causes the core dump, there is no MemoryContext
      in gtm/gtm_proxy.


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/postgres-xc/bugs/488/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

      Related

      Bugs: #488

      • Koichi Suzuki
        Koichi Suzuki
        2014-08-04

        Got it. Thanks.

        Koichi Suzuki

        2014-08-04 19:18 GMT+09:00 Koichi Suzuki koichi-szk@users.sf.net:

        Sorry, I couldn't find the patch.

        Koichi Suzuki

        2014-08-01 16:09 GMT+09:00 Pavan Deolasee pavanvd@users.sf.net:

        Thanks for the report. ISTM that we should create the memory context before

        we start processing the config file. As this example shows,
        set_config_option() may try to palloc memory which will fail if the memory
        context is not up. I propose attached patch. Please try and let us know.

        Attachment: xc_move_context_init.patch (3.8 kB; application/octet-stream)


        [bugs:#488] The use of palloc in gtm/gtm_proxy will cause a crash at some
        situation

        Status: open
        Group: 1.2 Dev Q
        Created: Thu Jul 31, 2014 09:05 AM UTC by peace zone
        Last Updated: Thu Jul 31, 2014 09:05 AM UTC
        Owner: nobody

        reproduce Step:
        1. set the "log_min_messages = DEUBG5" in gtm_proxy.conf -- DEUBG5 not
        DEBUG5
        2. gtm_proxy -D gtm_proxy.conf

        stack info:
        Program terminated with signal 11, Segmentation fault.

        0 0x00000000004131d1 in initStringInfo (str=0x7fffffffdde0) at
        stringinfo.c:89

        89 str->data = (char *) palloc(size);
        Missing separate debuginfos, use: debuginfo-install glibc-2.17-55.el7.x86_64
        (gdb) b
        Breakpoint 1 at 0x4131d1: file stringinfo.c, line 89.
        (gdb) bt

        0 0x00000000004131d1 in initStringInfo (str=0x7fffffffdde0) at
        stringinfo.c:89

        1 0x00000000004182d1 in config_enum_get_options (record=0x636380
        <ConfigureNamesEnum>, prefix=0x42bb59 "Available values: ", suffix=0x42bb57
        ".",

        separator=0x42bb54 ", ") at gtm_opt_handler.c:1853

        2 0x00000000004196d3 in set_config_option (name=0x63cba0 "log_min_messages",
        value=0x63cbc0 "DEUBG5", context=GTMC_STARTUP, source=GTMC_S_FILE,

        changeVal=0 '\000') at gtm_opt_handler.c:2529

        3 0x0000000000415d4a in ProcessConfigFile (context=GTMC_STARTUP) at
        gtm_opt_handler.c:202

        4 0x0000000000417923 in SelectConfigFiles (userDoption=0x638140
        "/data/pgxc/nodes/gtm_pxy", progname=0x42cba0 "gtm_proxy") at
        gtm_opt_handler.c:1441

        5 0x0000000000421d50 in main (argc=3, argv=0x7fffffffe1d8) at
        proxy_main.c:687

        Apparently the use of palloc causes the core dump, there is no MemoryContext
        in gtm/gtm_proxy.


        Sent from sourceforge.net because you indicated interest in
        https://sourceforge.net/p/postgres-xc/bugs/488/

        To unsubscribe from further messages, please visit
        https://sourceforge.net/auth/subscriptions/


        [bugs:#488] The use of palloc in gtm/gtm_proxy will cause a crash at some
        situation

        Status: open
        Group: 1.2 Dev Q
        Created: Thu Jul 31, 2014 09:05 AM UTC by peace zone
        Last Updated: Fri Aug 01, 2014 07:09 AM UTC
        Owner: nobody

        reproduce Step:
        1. set the "log_min_messages = DEUBG5" in gtm_proxy.conf -- DEUBG5 not
        DEBUG5
        2. gtm_proxy -D gtm_proxy.conf

        stack info:
        Program terminated with signal 11, Segmentation fault.

        0 0x00000000004131d1 in initStringInfo (str=0x7fffffffdde0) at
        stringinfo.c:89

        89 str->data = (char *) palloc(size);
        Missing separate debuginfos, use: debuginfo-install glibc-2.17-55.el7.x86_64
        (gdb) b
        Breakpoint 1 at 0x4131d1: file stringinfo.c, line 89.
        (gdb) bt

        0 0x00000000004131d1 in initStringInfo (str=0x7fffffffdde0) at
        stringinfo.c:89

        1 0x00000000004182d1 in config_enum_get_options (record=0x636380
        <ConfigureNamesEnum>, prefix=0x42bb59 "Available values: ", suffix=0x42bb57
        ".",

        separator=0x42bb54 ", ") at gtm_opt_handler.c:1853

        2 0x00000000004196d3 in set_config_option (name=0x63cba0 "log_min_messages",
        value=0x63cbc0 "DEUBG5", context=GTMC_STARTUP, source=GTMC_S_FILE,

        changeVal=0 '\000') at gtm_opt_handler.c:2529

        3 0x0000000000415d4a in ProcessConfigFile (context=GTMC_STARTUP) at
        gtm_opt_handler.c:202

        4 0x0000000000417923 in SelectConfigFiles (userDoption=0x638140
        "/data/pgxc/nodes/gtm_pxy", progname=0x42cba0 "gtm_proxy") at
        gtm_opt_handler.c:1441

        5 0x0000000000421d50 in main (argc=3, argv=0x7fffffffe1d8) at
        proxy_main.c:687

        Apparently the use of palloc causes the core dump, there is no MemoryContext
        in gtm/gtm_proxy.


        Sent from sourceforge.net because you indicated interest in
        https://sourceforge.net/p/postgres-xc/bugs/488/

        To unsubscribe from further messages, please visit
        https://sourceforge.net/auth/subscriptions/

         

        Related

        Bugs: #488

  • peace zone
    peace zone
    2014-08-04

    Hi,
    The patch see in the attachment.

    pingzhong.zhao@gmail.com

    From: Koichi Suzuki
    Date: 2014-08-04 18:18
    To: [postgres-xc:bugs]
    Subject: [postgres-xc:bugs] Re: #488 The use of palloc in gtm/gtm_proxy will cause a crash at some situation
    Sorry, I couldn't find the patch.
    Koichi Suzuki
    2014-08-01 16:09 GMT+09:00 Pavan Deolasee pavanvd@users.sf.net:
    Thanks for the report. ISTM that we should create the memory context before
    we start processing the config file. As this example shows,
    set_config_option() may try to palloc memory which will fail if the memory
    context is not up. I propose attached patch. Please try and let us know.
    Attachment: xc_move_context_init.patch (3.8 kB; application/octet-stream)

    [bugs:#488] The use of palloc in gtm/gtm_proxy will cause a crash at some
    situation
    Status: open
    Group: 1.2 Dev Q
    Created: Thu Jul 31, 2014 09:05 AM UTC by peace zone
    Last Updated: Thu Jul 31, 2014 09:05 AM UTC
    Owner: nobody
    reproduce Step:
    1. set the "log_min_messages = DEUBG5" in gtm_proxy.conf -- DEUBG5 not
    DEBUG5
    2. gtm_proxy -D gtm_proxy.conf
    stack info:
    Program terminated with signal 11, Segmentation fault.
    0 0x00000000004131d1 in initStringInfo (str=0x7fffffffdde0) at
    stringinfo.c:89
    89 str->data = (char *) palloc(size);
    Missing separate debuginfos, use: debuginfo-install glibc-2.17-55.el7.x86_64
    (gdb) b
    Breakpoint 1 at 0x4131d1: file stringinfo.c, line 89.
    (gdb) bt
    0 0x00000000004131d1 in initStringInfo (str=0x7fffffffdde0) at
    stringinfo.c:89
    1 0x00000000004182d1 in config_enum_get_options (record=0x636380
    <ConfigureNamesEnum>, prefix=0x42bb59 "Available values: ", suffix=0x42bb57
    ".",
    separator=0x42bb54 ", ") at gtm_opt_handler.c:1853
    2 0x00000000004196d3 in set_config_option (name=0x63cba0 "log_min_messages",
    value=0x63cbc0 "DEUBG5", context=GTMC_STARTUP, source=GTMC_S_FILE,
    changeVal=0 '\000') at gtm_opt_handler.c:2529
    3 0x0000000000415d4a in ProcessConfigFile (context=GTMC_STARTUP) at
    gtm_opt_handler.c:202
    4 0x0000000000417923 in SelectConfigFiles (userDoption=0x638140
    "/data/pgxc/nodes/gtm_pxy", progname=0x42cba0 "gtm_proxy") at
    gtm_opt_handler.c:1441
    5 0x0000000000421d50 in main (argc=3, argv=0x7fffffffe1d8) at
    proxy_main.c:687
    Apparently the use of palloc causes the core dump, there is no MemoryContext
    in gtm/gtm_proxy.

    Sent from sourceforge.net because you indicated interest in
    https://sourceforge.net/p/postgres-xc/bugs/488/
    To unsubscribe from further messages, please visit
    https://sourceforge.net/auth/subscriptions/

    [bugs:#488] The use of palloc in gtm/gtm_proxy will cause a crash at some situation
    Status: open
    Group: 1.2 Dev Q
    Created: Thu Jul 31, 2014 09:05 AM UTC by peace zone
    Last Updated: Fri Aug 01, 2014 07:09 AM UTC
    Owner: nobody
    reproduce Step:
    1. set the "log_min_messages = DEUBG5" in gtm_proxy.conf -- DEUBG5 not DEBUG5
    2. gtm_proxy -D gtm_proxy.conf
    stack info:
    Program terminated with signal 11, Segmentation fault.
    0 0x00000000004131d1 in initStringInfo (str=0x7fffffffdde0) at stringinfo.c:89
    89 str->data = (char *) palloc(size);
    Missing separate debuginfos, use: debuginfo-install glibc-2.17-55.el7.x86_64
    (gdb) b
    Breakpoint 1 at 0x4131d1: file stringinfo.c, line 89.
    (gdb) bt
    0 0x00000000004131d1 in initStringInfo (str=0x7fffffffdde0) at stringinfo.c:89
    1 0x00000000004182d1 in config_enum_get_options (record=0x636380 <ConfigureNamesEnum>, prefix=0x42bb59 "Available values: ", suffix=0x42bb57 ".",
    separator=0x42bb54 ", ") at gtm_opt_handler.c:1853
    2 0x00000000004196d3 in set_config_option (name=0x63cba0 "log_min_messages", value=0x63cbc0 "DEUBG5", context=GTMC_STARTUP, source=GTMC_S_FILE,
    changeVal=0 '\000') at gtm_opt_handler.c:2529
    3 0x0000000000415d4a in ProcessConfigFile (context=GTMC_STARTUP) at gtm_opt_handler.c:202
    4 0x0000000000417923 in SelectConfigFiles (userDoption=0x638140 "/data/pgxc/nodes/gtm_pxy", progname=0x42cba0 "gtm_proxy") at gtm_opt_handler.c:1441
    5 0x0000000000421d50 in main (argc=3, argv=0x7fffffffe1d8) at proxy_main.c:687
    Apparently the use of palloc causes the core dump, there is no MemoryContext in gtm/gtm_proxy.

    Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/postgres-xc/bugs/488/
    To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

     

    Related

    Bugs: #488