Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    static variable not initialize?

    hello, my program running on redhat 5.7, kernel version is 2.6.18-274.el5 x86_64, meanwhile, there have a shell to watch it, this shell use awk '{print $2}' to analyze the result of ps aux, after several days(or several hours/month) the system seems has some problem, call awk from shell will be crashed!

    -bash-3.2# awk '{print $2}'
    awk: cmd. line:1: fatal error: internal error
    but just call awk won't crash:
    -bash-3.2# awk --version
    GNU Awk 3.1.5
    Copyright (C) 1989, 1991-2005 Free Software Foundation.
    I try to debug it use gdb , and find the static variable ftable won't initialized, then I check other program, find tcpdump and other also have this problem, this make me confused, I have no idea why the static variable not initialized.

    the way I debug it:
    gdb --args awk '{print $1}'
    start the program, then print static variable ftable when the program crash(print it when you set a broken point in main()have the same result), the result is:
    (gdb) p ftable
    $1 = {0x0 <repeats 452 times>, 0x78756e694c, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x3570616d6d00, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x38312e362e320000, 0x356c652e3437322d, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x4d53203123000000, 
      0x754a206972462050, 0x333a37312038206c, 0x5444452039353a36, 0x3131303220, 0x0, 0x0, 0x0, 0x5f36387800000000, 0x3436, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x6f6e280000000000, 0x29656e, 0x0 <repeats 527 times>}
    I test it on a health system, the result is:
    (gdb) p ftable 
    $1 = {0x0 <repeats 1021 times>}
    Is there anyone can give me some advise? Thank you very much!!!!

  2. #2
    Linux User Krendoshazin's Avatar
    Join Date
    Feb 2005
    London, England
    What exactly are you trying to do? From your examples it seem as if you're trying to use awk by itself to print something, and yet it has nothing to print.

    Can you show us the commands or script you're using to analyse the output of 'ps aux'?

  3. #3
    Krendoshazin, thank you for the reply,
    I just use
    ps aux | grep ice | grep -v grep | awk '{print $2}'
    to get my program pid. It works well before the system become illegal.

  4. $spacer_open

Posting Permissions

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