- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- files are open though i have closed it
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2004 11:04 AM
09-07-2004 11:04 AM
I am facing a strange situation.
I have a main process which forks multiple process and for each process it opens individual file descripter.
like the following code.
if ((pid = fork()) == 0)
{
sprintf(filename, "%s/XXX.new", DEBUG_PATH);
fd = open(filename, O_RDWR|O_CREAT|O_TRUNC, PERM);
close(2);
dup(fd);
close(1);
dup(fd);
Later during the normal backup process. each process closes the current file descripter and
renames it some different file name and
opens a new file descripter.
The code is like this
fflush(stdout);
fflush(stderr);
rename(debug_filename,debug_oldfilename);
fd = open(debug_filename, O_RDWR|O_CREAT|O_TRUNC, PERM);
close(2);
dup(fd);
close(1);
dup(fd);
after the new files are created , old files are zipped and moved to other back pu filessystem by some other process.
Every thing is running fine. But the problem
is though the files are moved from the directory , the space is not freed.
So, after some times we are facing space problem. where the du showing we have spaces but bdf is showing the disk is full, because
the files were still open, when they are moved.
I am using HP UX 11.0
Can anyone plz suggest me the wayout ...
I can not restart the processes due to business constraint.
Thanks in advance.
Smaran
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2004 01:18 PM
09-07-2004 01:18 PM
Re: files are open though i have closed it
Now this may be your job. Make sure the process closes itself down when its done. It may be the job that maintained them or created them in the first place.
fuser -cu will list processes in a filesystem.
See if you can figure out what process is still trying to have a filehandle open.
You can kill a process one at a time or en masse with the fuser -cuk /filesystem command.
That second command is the filesystem equivalent of nuclear weapons. You may need a more precise way of doing it.
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2004 03:11 PM
09-07-2004 03:11 PM
Re: files are open though i have closed it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-07-2004 08:33 PM
09-07-2004 08:33 PM
Re: files are open though i have closed it
Apparantly you did not clsoe(fd)
fd = open(filename, O_RDWR|O_CREAT|O_TRUNC, PERM);
close(2);
dup(fd);
close(1);
dup(fd);
close(fd); /*HERE*/
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2004 02:08 AM
09-08-2004 02:08 AM
Re: files are open though i have closed it
From the discussion What I understand,
As I am opening the file from some other
process (parent process which is forking)
and tries to close the file in the child pro
cess, and all the processes are running continously, so the spece is not freed.
If I put the whole opening and closing logic
in a single program , it should work.
Plz clarify me in this point.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-08-2004 02:27 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-09-2004 09:15 AM
09-09-2004 09:15 AM
Re: files are open though i have closed it
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-14-2004 08:11 AM
10-14-2004 08:11 AM
Re: files are open though i have closed it
Even no points is OK, but do not close threads with unassigned posts in it.