Page 1 of 3 123 LastLast
Results 1 to 10 of 21

Thread: fuser forking uncontrollably in cron job

  1. #1
    Join Date
    Jun 2008
    Location
    Lancashire, UK
    Beans
    17
    Distro
    Ubuntu 10.04 Lucid Lynx

    Question fuser forking uncontrollably in cron job

    Hi

    On my Ubuntu Server 11.10 box, several thousand fuser processes are being created every half an hour. (This didn't happen in 11.04.) I traced the problem back to the cron job '/etc/cron.d/php5', which contains the entry:
    Code:
    [ -x /usr/lib/php5/maxlifetime ] && [ -d /var/lib/php5 ] && find /var/lib/php5/ -depth -mindepth 1 -maxdepth 1 -type f -cmin +$(/usr/lib/php5/maxlifetime) ! -execdir fuser -s {} 2>/dev/null \; -delete
    I think this removes old PHP sessions.

    This is an extract from 'ps aux':
    Code:
    root      1636  0.0  0.0      0     0 ?        Z    23:51   0:00 [fuser] <defunct>
    root      1637  0.0  0.0      0     0 ?        Z    23:51   0:00 [fuser] <defunct>
    root      1638  0.0  0.0      0     0 ?        Z    23:51   0:00 [fuser] <defunct>
    root      1639  0.0  0.0      0     0 ?        Z    23:51   0:00 [fuser] <defunct>
    (many, many more...)
    ...
    
    real    0m10.832s
    user    0m2.796s
    sys     0m4.952s
    There are thousands of these, but they do disappear eventually. Once the cron job exits, all the defunct processes are cleaned up, presumably by init.
    This also puts my system load up to about 2 every half an hour.

    I could remove the cron job, but I'd imagine PHP sessions wouldn't be cleared up then. I couldn't find any bugs to do with fuser, but it could be perhaps to do with 'find' calling fuser.

    Attached is a graph showing load average of this server.

    Any ideas on what to do?

    Thanks,
    Will
    Attached Images Attached Images

  2. #2
    Join Date
    Jul 2011
    Beans
    4

    Re: fuser forking uncontrollably in cron job

    I have the exact same problem. Upgraded Ubuntu 11.04 -> 11.10 then I started getting the error "Failed to fork: Cannot allocate memory" at random times. When I looked into it I found the exact same issue Will describes.

    I disabled that cron job to fix it for now..
    Last edited by Hizeh; October 17th, 2011 at 04:27 AM.

  3. #3
    Join Date
    Sep 2011
    Beans
    2

    Re: fuser forking uncontrollably in cron job

    i have exactly the same problem too (11.04 -> 11.10)

  4. #4
    Join Date
    Oct 2011
    Beans
    2

    Re: fuser forking uncontrollably in cron job

    Registerd to confirm this bug
    Updated two servers both have the issue.
    Also: testing with disabled cron on one server as i speak will report back!


    EDIT:
    So far: disabling the cron did the trick.
    Now trying new version of php
    Last edited by devilmastah; October 18th, 2011 at 01:28 AM.

  5. #5
    Join Date
    Jul 2011
    Beans
    4

    Re: fuser forking uncontrollably in cron job

    Did updating php5 fix it?

  6. #6
    Join Date
    Apr 2006
    Beans
    Hidden!

    Re: fuser forking uncontrollably in cron job

    I've just upgraded 35 servers from 11.04 to 11.10 and we only have one server that has this issue.
    Running PHP-fpm as with all the others, and it's doing exactly as described above.
    I've seen 18,000 or so defunct fuser processes within a few hours of upgrading the server.
    This is with the new PHP security release that came out today.

  7. #7
    Join Date
    Apr 2006
    Beans
    Hidden!

    Re: fuser forking uncontrollably in cron job

    # ps -ef | grep fuser|wc -l
    29751

    It's getting pretty high now, that is with an uptime of 1hr 19 min
    I've disabled the script in /etc/cron.d/php5 temporarily.

  8. #8
    Join Date
    Oct 2011
    Beans
    2

    Re: fuser forking uncontrollably in cron job

    Quote Originally Posted by Hizeh View Post
    Did updating php5 fix it?
    Nope it didnt
    Waiting for a patch

  9. #9
    Join Date
    May 2010
    Location
    uk
    Beans
    9,249
    Distro
    Xubuntu 14.04 Trusty Tahr

    Re: fuser forking uncontrollably in cron job

    Hi

    I couldn't find any bugs to do with fuser, but it could be perhaps to do with 'find' calling fuser.
    Total shot in the dark but do you still have problems if you edit the cron job to use

    Code:
    lsof -t {}
    instead of

    Code:
    fuser -s {}
    They both return pids so i assume they would perform the same function and an error code of 1 on failure; 0 on sucesss.

    From man lsof

    -t This option specifies that lsof should produce terse output with process identifiers only and no header - e.g., so that the output may be piped to kill(1).
    This option selects the -w option.
    From man fuser

    fuser displays the PIDs of processes using the specified files or file systems.
    Might be worth a try ?

    EDIT: You might have to pipe stdout and stderr to /dev/null.

    Kind regards
    Last edited by matt_symes; October 18th, 2011 at 07:36 PM.
    If you believe everything you read, you better not read. ~ Japanese Proverb

    If you don't read the newspaper, you're uninformed. If you read the newspaper, you're mis-informed. - Mark Twain

    Thinking about becoming an Ubuntu Member?

  10. #10
    Join Date
    Jul 2011
    Beans
    4

    Re: fuser forking uncontrollably in cron job

    I tried matt_symes fix and the "lsof -t" does not fork uncontrollably like fuser was doing.

    But, I'm not sure how to check if it is actually clearing old PHP sessions.

Page 1 of 3 123 LastLast

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
  •