system() call problem

My c program use system() to execute a script which invoke a file transfer
every minute. This will be hang up randomly once daily or twice weekly. Does
any one encounter this before?

Thanks in advance.
Derek

Derek <kawachan@hko.gov.hk> wrote:

My c program use system() to execute a script which invoke a file transfer
every minute. This will be hang up randomly once daily or twice weekly. Does
any one encounter this before?

Assuming you are using Neutrino (QNX6), when the hang occurs - what is the
output of pidin?

chris


Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/

Yes, 6.1.0A

I still left my program hang, pidin listed below…

pid tid name prio STATE Blocked
1 1 procnto 0f READY
1 2 procnto 10r RECEIVE 1
1 3 procnto 63r RECEIVE 1
1 4 procnto 63r RECEIVE 1
1 5 procnto 10r RECEIVE 1
1 6 procnto 10r RECEIVE 1
1 7 procnto 10r RECEIVE 1
1 9 procnto 6r NANOSLEEP
1 10 procnto 10r RUNNING
1 11 procnto 10r RECEIVE 1
1 12 procnto 10r RECEIVE 1
1 14 procnto 10r RECEIVE 1
2 1 sbin/tinit 10o REPLY 364567
3 1 proc/boot/slogger 10o RECEIVE 1
12292 1 sbin/mqueue 10o RECEIVE 1
5 1 proc/boot/pci-bios 10o RECEIVE 1
6 1 roc/boot/devb-eide 10o SIGWAITINFO
6 2 roc/boot/devb-eide 21r RECEIVE 1
6 3 roc/boot/devb-eide 21r RECEIVE 4
6 4 roc/boot/devb-eide 10o RECEIVE 10
6 5 roc/boot/devb-eide 10r CONDVAR b037866c
6 7 roc/boot/devb-eide 10o RECEIVE 7
6 8 roc/boot/devb-eide 10o RECEIVE 7
6 9 roc/boot/devb-eide 10o RECEIVE 7
7 1 /x86/sbin/devc-con 10o RECEIVE 1
8 1 hA/x86/sbin/fs-pkg 10o RECEIVE 1
8 2 hA/x86/sbin/fs-pkg 10o SIGWAITINFO
8 3 hA/x86/sbin/fs-pkg 10o RECEIVE 1
8 4 hA/x86/sbin/fs-pkg 10o RECEIVE 1
8 5 hA/x86/sbin/fs-pkg 10o RECEIVE 1
8 6 hA/x86/sbin/fs-pkg 10o RECEIVE 1
4105 1 sbin/pipe 10o RECEIVE 1
4105 2 sbin/pipe 10o RECEIVE 1
4105 3 sbin/pipe 10o RECEIVE 1
4105 4 sbin/pipe 10o RECEIVE 1
237578 1 sbin/devc-ser8250 24o RECEIVE 1
45067 1 sbin/devc-pty 20o RECEIVE 1
77836 1 sbin/devc-par 10o RECEIVE 1
77836 2 sbin/devc-par 9r CONDVAR 804f938
118797 1 sbin/devb-fdc 10o SIGWAITINFO
118797 2 sbin/devb-fdc 21r RECEIVE 1
118797 3 sbin/devb-fdc 10o RECEIVE 7
118797 4 sbin/devb-fdc 10o CONDVAR b037866c
118797 5 sbin/devb-fdc 10o RECEIVE 4
118797 6 sbin/devb-fdc 10o RECEIVE 4
77838 1 usr/sbin/spooler 10o NANOSLEEP
77839 1 sbin/io-net 10o SIGWAITINFO
77839 2 sbin/io-net 10o RECEIVE 1
77839 3 sbin/io-net 10o RECEIVE 1
77839 6 sbin/io-net 10o RECEIVE 6
77839 7 sbin/io-net 10o RECEIVE 22
77839 8 sbin/io-net 21r RECEIVE 16
77839 9 sbin/io-net 10o RECEIVE 1
77839 10 sbin/io-net 10o RECEIVE 1
77839 13 sbin/io-net 10o CONDVAR 809727c
253968 1 usr/sbin/dumper 10o RECEIVE 1
94225 1 sbin/devc-ser8250 24o RECEIVE 1
208914 1 usr/sbin/random 10o SIGWAITINFO
208914 2 usr/sbin/random 10o RECEIVE 1
208914 3 usr/sbin/random 10o NANOSLEEP
679955 1 r/photon/bin/pterm 10r RECEIVE 1
274452 1 tral/awscen-mlink4 10o REPLY 1
299029 1 tral/awscen-mlink4 10o REPLY 1
561174 1 usr/photon/bin/pwm 10r RECEIVE 1
364567 1 /photon/bin/Photon 10r RECEIVE 1
409624 1 ton/bin/fontsleuth 6o RECEIVE 1
409624 2 ton/bin/fontsleuth 6o RECEIVE 1
409624 3 ton/bin/fontsleuth 10o RECEIVE 1
606233 1 r/photon/bin/shelf 10r RECEIVE 1
606233 2 r/photon/bin/shelf 10r CONDVAR b049bacc
401434 1 hoton/bin/phfontFA 12r RECEIVE 1
442395 1 on/bin/io-graphics 12r REPLY 364567
679964 1 bin/sh 10r REPLY 45067
458781 1 ton/bin/devi-hirun 15o RECEIVE 1
458781 2 ton/bin/devi-hirun 10o REPLY 7
458781 3 ton/bin/devi-hirun 12o SIGWAITINFO
643102 1 photon/bin/bkgdmgr 10r RECEIVE 1
643103 1 hoton/bin/wmswitch 10r RECEIVE 2
643104 1 r/photon/bin/saver 10r RECEIVE 1
733217 1 r/photon/bin/pterm 10r RECEIVE 1
651298 1 /X11R6/bin/Xphoton 10r SIGWAITINFO
733219 1 bin/sh 10r REPLY 45067
733220 1 r/photon/bin/pterm 10r RECEIVE 1
651301 1 usr/X11R6/bin/gtwm 10r SIGWAITINFO
733222 1 bin/sh 10r REPLY 45067
74379303 1 bin/sh 10o SIGSUSPEND
16498728 1 usr/bin/tcpdump 10r REPLY 77839
2269225 1 r/photon/bin/pterm 10r RECEIVE 1
2269226 1 bin/sh 10r REPLY 45067
74379307 1 bin/sh 10o SIGSUSPEND
74387500 1 usr/bin/ftp 10o REPLY 77839
74625069 1 bin/sh 10o SIGSUSPEND
74625070 1 bin/sh 10o SIGSUSPEND
74633263 1 usr/bin/ftp 10o REPLY 77839
74645552 1 r/photon/bin/pterm 10r RECEIVE 1
74645553 1 bin/sh 10r SIGSUSPEND
74645554 1 usr/bin/telnet 10r SIGWAITINFO
74649651 1 r/photon/bin/pterm 10r RECEIVE 1
74649652 1 bin/sh 10r SIGSUSPEND
74649653 1 usr/bin/telnet 10r SIGWAITINFO
74661942 1 usr/photon/bin/ped 10r REPLY 364567
74661943 1 r/photon/bin/pterm 10r RECEIVE 1
74661944 1 bin/sh 10r REPLY 45067
74858553 1 r/photon/bin/pterm 10r RECEIVE 1
74858554 1 bin/sh 10r SIGSUSPEND
74887227 1 photon/bin/voyager 10r RECEIVE 2
74887228 1 photon/bin/vserver 10r RECEIVE 1
74887229 1 lugins/flashplayer 10r RECEIVE 2
74887230 1 photon/bin/voyager 10r RECEIVE 2
75010111 1 bin/pidin 10r REPLY 1

The script invoke a file transfter using ftp. Since I ran two piece of my
program, so two ftp will be found. I got both system()s hang at not exactly
but close within an hour. I started tcpdump before they hang. Do you want
the log file?

Thankyou Chris

“Chris McKillop” <cdm@qnx.com> ¼¶¼g©ó¶l¥ó news:ajujl8$oiv$1@nntp.qnx.com

Derek <> kawachan@hko.gov.hk> > wrote:
My c program use system() to execute a script which invoke a file
transfer
every minute. This will be hang up randomly once daily or twice weekly.
Does
any one encounter this before?


Assuming you are using Neutrino (QNX6), when the hang occurs - what is the
output of pidin?

chris


Chris McKillop <> cdm@qnx.com> > “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/

274452 1 tral/awscen-mlink4 10o REPLY 1
299029 1 tral/awscen-mlink4 10o REPLY 1

These are your two processes right? What else are they doing besides
making this system() call?

chris

\

Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/

Yes.
They have to do nothing but just waiting return from system().
Actually, these program works independently to acquire data from seperate
serial ports by polling. The program was written as if they were in a single
tasking environment.

Derek

“Chris McKillop” <cdm@qnx.com> ¼¶¼g©ó¶l¥ó news:ak1ofu$nos$1@nntp.qnx.com

274452 1 tral/awscen-mlink4 10o REPLY 1
299029 1 tral/awscen-mlink4 10o REPLY 1


These are your two processes right? What else are they doing besides
making this system() call?

chris

\

Chris McKillop <> cdm@qnx.com> > “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/

kwchan <kawachan@hko.gcn.gov.hk> wrote:

The script invoke a file transfter using ftp. Since I ran two piece of my
program, so two ftp will be found. I got both system()s hang at not exactly
but close within an hour. I started tcpdump before they hang. Do you want
the log file?

This is obverious question but …, you DID tested your script file
(which contains ftp) that it works without needs to interact with
console? (ftp usually need you type in stuff, but you could configure
it so that it runs automaticlly).

Do you have any relative path in script? Does your script depends on
any env variables? These thing may not the same while you test your
script directly, and system() it from a program.

-xtang

The ftp was configured without console interaction. The configuration will
get ftp login a target server, change the path, copy a file and exit the
ftp. A new destination file name was assigned each time before the ftp was
invoked. When it hang, the file at the destination server has file size
zero. I have to kill the ftp process so that system() can return to my
program. It seems that the file transfer cannot be completed.

derek

Xiaodan Tang <xtang@qnx.com> wrote in message
news:ak30dh$bib$1@nntp.qnx.com

kwchan <> kawachan@hko.gcn.gov.hk> > wrote:

The script invoke a file transfter using ftp. Since I ran two piece of
my
program, so two ftp will be found. I got both system()s hang at not
exactly
but close within an hour. I started tcpdump before they hang. Do you
want
the log file?

This is obverious question but …, you DID tested your script file
(which contains ftp) that it works without needs to interact with
console? (ftp usually need you type in stuff, but you could configure
it so that it runs automaticlly).

Do you have any relative path in script? Does your script depends on
any env variables? These thing may not the same while you test your
script directly, and system() it from a program.

-xtang

I found similar thread (attached below) but without any solution.

derek

From: “Chris Southern” <csouthern@sprintmail.com>
Subject: FTP is stuck
Date: 1999/06/14
Message-ID: <7k30sf$os2$1@fir.prod.itd.earthlink.net>#1/1
X-Posted-Path-Was: not-for-mail
Content-Type: multipart/alternative; boundary"---- NextPart 000 001E
01BEB64A.1D1800A0"
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
X-ELN-Date: 14 Jun 1999 13:42:39 GMT
X-ELN-Insert-Date: Mon Jun 14 06:55:10 1999
Organization: EarthLink Network, Inc.
Mime-Version: 1.0
Newsgroups: comp.os.qnx


We have a script that runs every two minutes. It will ftp to a
remote host, check a directory, and pass files. Depending upon the
customer, the remote computer could be Unix, AS/400, etc. Several times
we have experienced conditions where the script appears to terminate.
Upon further examination, we found that the ftp process is stuck. We
can verify this by doing a sin. Normally ftp should connect, get a
directory listing and exit. Its not a matter of a timeout; the most
recent ‘hang’ lasted three days. FTP never recovers, it has to be
killed. Has anyone ever experienced this or better yet, is there an
explanation?


csouthern@buschmanco.com

Chris Southern
Controls Project Engineer
Cincinnati, Ohio

Yeah - definatly looks like an issue with ftp.

So now it is a matter of if the issue is with our ftp client or with the
stack. My guess is the client. Have you tried using ncftp instead of
plain ftp? Might be worth a shot.

chris


Derek <kawachan@hko.gov.hk> wrote:

I found similar thread (attached below) but without any solution.

derek

From: “Chris Southern” <> csouthern@sprintmail.com
Subject: FTP is stuck
Date: 1999/06/14
Message-ID: <7k30sf$os2$> 1@fir.prod.itd.earthlink.net> >#1/1
X-Posted-Path-Was: not-for-mail
Content-Type: multipart/alternative; boundary"---- NextPart 000 001E
01BEB64A.1D1800A0"
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
X-ELN-Date: 14 Jun 1999 13:42:39 GMT
X-ELN-Insert-Date: Mon Jun 14 06:55:10 1999
Organization: EarthLink Network, Inc.
Mime-Version: 1.0
Newsgroups: comp.os.qnx


We have a script that runs every two minutes. It will ftp to a
remote host, check a directory, and pass files. Depending upon the
customer, the remote computer could be Unix, AS/400, etc. Several times
we have experienced conditions where the script appears to terminate.
Upon further examination, we found that the ftp process is stuck. We
can verify this by doing a sin. Normally ftp should connect, get a
directory listing and exit. Its not a matter of a timeout; the most
recent ‘hang’ lasted three days. FTP never recovers, it has to be
killed. Has anyone ever experienced this or better yet, is there an
explanation?


csouthern@buschmanco.com

Chris Southern
Controls Project Engineer
Cincinnati, Ohio


\


Chris McKillop <cdm@qnx.com> “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/

Could it be verified by tcpdump?

Now reconfigured to use ncftpput. It needs to wait some time!

derek with thanks

“Chris McKillop” <cdm@qnx.com> ¼¶¼g©ó¶l¥ó news:ak3gmp$vf$1@nntp.qnx.com

Yeah - definatly looks like an issue with ftp.

So now it is a matter of if the issue is with our ftp client or with the
stack. My guess is the client. Have you tried using ncftp instead of
plain ftp? Might be worth a shot.

chris


Derek <> kawachan@hko.gov.hk> > wrote:
I found similar thread (attached below) but without any solution.

derek

From: “Chris Southern” <> csouthern@sprintmail.com
Subject: FTP is stuck
Date: 1999/06/14
Message-ID: <7k30sf$os2$> 1@fir.prod.itd.earthlink.net> >#1/1
X-Posted-Path-Was: not-for-mail
Content-Type: multipart/alternative; boundary"---- NextPart 000 001E
01BEB64A.1D1800A0"
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
X-ELN-Date: 14 Jun 1999 13:42:39 GMT
X-ELN-Insert-Date: Mon Jun 14 06:55:10 1999
Organization: EarthLink Network, Inc.
Mime-Version: 1.0
Newsgroups: comp.os.qnx


We have a script that runs every two minutes. It will ftp to a
remote host, check a directory, and pass files. Depending upon the
customer, the remote computer could be Unix, AS/400, etc. Several times
we have experienced conditions where the script appears to terminate.
Upon further examination, we found that the ftp process is stuck. We
can verify this by doing a sin. Normally ftp should connect, get a
directory listing and exit. Its not a matter of a timeout; the most
recent ‘hang’ lasted three days. FTP never recovers, it has to be
killed. Has anyone ever experienced this or better yet, is there an
explanation?


csouthern@buschmanco.com

Chris Southern
Controls Project Engineer
Cincinnati, Ohio





\

Chris McKillop <> cdm@qnx.com> > “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/

Here’s a script I made to try to reproduce this. No luck so far:

-seanb


#!/bin/sh

let i=1
while [ $i != 0 ]; do

ftp -n 127.1 <<HERE
user seanb f
lcd /home/seanb/blah
cd /tmp
put blah blah$i
bye
HERE

rm /tmp/blah$i
let i=$i+1
sleep 2
done

Chris McKillop <cdm@qnx.com> wrote:

Yeah - definatly looks like an issue with ftp.

So now it is a matter of if the issue is with our ftp client or with the
stack. My guess is the client. Have you tried using ncftp instead of
plain ftp? Might be worth a shot.

chris



Derek <> kawachan@hko.gov.hk> > wrote:
I found similar thread (attached below) but without any solution.

derek

From: “Chris Southern” <> csouthern@sprintmail.com
Subject: FTP is stuck
Date: 1999/06/14
Message-ID: <7k30sf$os2$> 1@fir.prod.itd.earthlink.net> >#1/1
X-Posted-Path-Was: not-for-mail
Content-Type: multipart/alternative; boundary"---- NextPart 000 001E
01BEB64A.1D1800A0"
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
X-ELN-Date: 14 Jun 1999 13:42:39 GMT
X-ELN-Insert-Date: Mon Jun 14 06:55:10 1999
Organization: EarthLink Network, Inc.
Mime-Version: 1.0
Newsgroups: comp.os.qnx


We have a script that runs every two minutes. It will ftp to a
remote host, check a directory, and pass files. Depending upon the
customer, the remote computer could be Unix, AS/400, etc. Several times
we have experienced conditions where the script appears to terminate.
Upon further examination, we found that the ftp process is stuck. We
can verify this by doing a sin. Normally ftp should connect, get a
directory listing and exit. Its not a matter of a timeout; the most
recent ‘hang’ lasted three days. FTP never recovers, it has to be
killed. Has anyone ever experienced this or better yet, is there an
explanation?


csouthern@buschmanco.com

Chris Southern
Controls Project Engineer
Cincinnati, Ohio





\

Chris McKillop <> cdm@qnx.com> > “The faster I go, the behinder I get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/

Sometime the ftp server tries to do a Reverse DNS for the src ip of the
connection request it is getting.May be this is causing the hang.If you
have root previlages to the Server add your clients IP address in the hosts
file of the server.

Hope that helps

Sreekanth

“Sean Boudreau” <seanb@node25.ott.qnx.com> wrote in message
news:ak5dcs$am2$1@nntp.qnx.com

Here’s a script I made to try to reproduce this. No luck so far:

-seanb


#!/bin/sh

let i=1
while [ $i != 0 ]; do

ftp -n 127.1 <<HERE
user seanb f
lcd /home/seanb/blah
cd /tmp
put blah blah$i
bye
HERE

rm /tmp/blah$i
let i=$i+1
sleep 2
done

Chris McKillop <> cdm@qnx.com> > wrote:

Yeah - definatly looks like an issue with ftp.

So now it is a matter of if the issue is with our ftp client or with the
stack. My guess is the client. Have you tried using ncftp instead of
plain ftp? Might be worth a shot.

chris


Derek <> kawachan@hko.gov.hk> > wrote:
I found similar thread (attached below) but without any solution.

derek

From: “Chris Southern” <> csouthern@sprintmail.com
Subject: FTP is stuck
Date: 1999/06/14
Message-ID: <7k30sf$os2$> 1@fir.prod.itd.earthlink.net> >#1/1
X-Posted-Path-Was: not-for-mail
Content-Type: multipart/alternative; boundary"---- NextPart 000 001E
01BEB64A.1D1800A0"
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
X-ELN-Date: 14 Jun 1999 13:42:39 GMT
X-ELN-Insert-Date: Mon Jun 14 06:55:10 1999
Organization: EarthLink Network, Inc.
Mime-Version: 1.0
Newsgroups: comp.os.qnx


We have a script that runs every two minutes. It will ftp to a
remote host, check a directory, and pass files. Depending upon the
customer, the remote computer could be Unix, AS/400, etc. Several
times
we have experienced conditions where the script appears to terminate.
Upon further examination, we found that the ftp process is stuck. We
can verify this by doing a sin. Normally ftp should connect, get a
directory listing and exit. Its not a matter of a timeout; the most
recent ‘hang’ lasted three days. FTP never recovers, it has to be
killed. Has anyone ever experienced this or better yet, is there an
explanation?


csouthern@buschmanco.com

Chris Southern
Controls Project Engineer
Cincinnati, Ohio





\

Chris McKillop <> cdm@qnx.com> > “The faster I go, the behinder I
get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/

Since a name server is using in the LAN, will this help in adding IP address
in the ftp server?

derek


Sreekanth <sreekanth@cambira.com> wrote in message
news:akgb75$gu2$1@inn.qnx.com

Sometime the ftp server tries to do a Reverse DNS for the src ip of the
connection request it is getting.May be this is causing the hang.If you
have root previlages to the Server add your clients IP address in the
hosts
file of the server.

Hope that helps

Sreekanth

“Sean Boudreau” <> seanb@node25.ott.qnx.com> > wrote in message
news:ak5dcs$am2$> 1@nntp.qnx.com> …

Here’s a script I made to try to reproduce this. No luck so far:

-seanb


#!/bin/sh

let i=1
while [ $i != 0 ]; do

ftp -n 127.1 <<HERE
user seanb f
lcd /home/seanb/blah
cd /tmp
put blah blah$i
bye
HERE

rm /tmp/blah$i
let i=$i+1
sleep 2
done

Chris McKillop <> cdm@qnx.com> > wrote:

Yeah - definatly looks like an issue with ftp.

So now it is a matter of if the issue is with our ftp client or with
the
stack. My guess is the client. Have you tried using ncftp instead of
plain ftp? Might be worth a shot.

chris


Derek <> kawachan@hko.gov.hk> > wrote:
I found similar thread (attached below) but without any solution.

derek

From: “Chris Southern” <> csouthern@sprintmail.com
Subject: FTP is stuck
Date: 1999/06/14
Message-ID: <7k30sf$os2$> 1@fir.prod.itd.earthlink.net> >#1/1
X-Posted-Path-Was: not-for-mail
Content-Type: multipart/alternative; boundary"---- NextPart 000 001E
01BEB64A.1D1800A0"
X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3110.3
X-ELN-Date: 14 Jun 1999 13:42:39 GMT
X-ELN-Insert-Date: Mon Jun 14 06:55:10 1999
Organization: EarthLink Network, Inc.
Mime-Version: 1.0
Newsgroups: comp.os.qnx


We have a script that runs every two minutes. It will ftp to a
remote host, check a directory, and pass files. Depending upon the
customer, the remote computer could be Unix, AS/400, etc. Several
times
we have experienced conditions where the script appears to terminate.
Upon further examination, we found that the ftp process is stuck. We
can verify this by doing a sin. Normally ftp should connect, get a
directory listing and exit. Its not a matter of a timeout; the most
recent ‘hang’ lasted three days. FTP never recovers, it has to be
killed. Has anyone ever experienced this or better yet, is there an
explanation?


csouthern@buschmanco.com

Chris Southern
Controls Project Engineer
Cincinnati, Ohio





\

Chris McKillop <> cdm@qnx.com> > “The faster I go, the behinder I
get.”
Software Engineer, QSSL – Lewis Carroll –
http://qnx.wox.org/
\