Free Downloads, Community Forum,
FAQs and Developer Resources


Make /Tools Your Home | Link to us

Today's posts | Posts since last visit | Most Active Topics

All Forums Register Login Search Subscriptions My Profile Inbox
Tool Warehouse FAQs Resources Help Member List Address Book Logout

Device Busy

 
Logged in as: Guest
Users viewing this topic: none
  Printable Version
All Forums >> [SFU / Interix / SUA Technology] >> Interix Advanced Forum >> Device Busy Page: [1]
Login
Message << Older Topic   Newer Topic >>
Device Busy - Apr. 24, '05, 9:07:01 PM   
smahler

 

Posts: 10
Joined: Apr. 13, '05,
Status: offline
I've been building a bunch of shell scripts that run awk, sed, and alike. They leave output in temp files on the disk (accessed by a name that points at the SFU root). WHen you run the scripts again they "rm -rf" the files. Sometimes, not everytime after the "rm -rf" completes, later in the script you can't create the file with the name of the file you just zapped. You get "device busy"

I can create another file with a different name in the same directory.

If I "ls" the directory I see the "deleted file". If I "ls -l" the directory I get a warning message the the orginal file is ... "ls: f1: busy"

Closing both open shells, and reopening a single shell seems to bring things back to normal.

Any ideas??

...S

< Message edited by smahler -- Apr. 24, '05, 9:14:16 PM >
Post #: 1
RE: Device Busy - Apr. 24, '05, 11:37:13 PM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
When you get in the situation of "busy", does a 'ps -A -Xunix' show any processes still
running from the script that might have accessed the temporary file ?
The "busy" usually indicates that something still has a hold on the file but it's a
marked file for delete, that's why I ask.

You might be interested, as a work-around, in your scripts to use mktemp(1) to
generate temporary filenames. This way each run of the script gets a different temporary
filename so it can run successfully. The mktemp utility is part of the mktemp
package in the /Tools warehouse.

(in reply to smahler)
Post #: 2
RE: Device Busy - Apr. 25, '05, 7:52:49 PM   
smahler

 

Posts: 10
Joined: Apr. 13, '05,
Status: offline
The ps does not show any unexpected process. None of the processes are associated with the application.

(I don't need mktemp, the file names are part of a simple application.)

...S

(in reply to smahler)
Post #: 3
RE: Device Busy - Apr. 26, '05, 2:50:43 AM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
The scripts that you run have "#!/bin/sh" at the top, right?

When you run these scripts the shell that you are using is ?

Have you tried starting the scripts from a different shell (csh, zsh, bash) ?

(in reply to smahler)
Post #: 4
RE: Device Busy - May 4, '05, 2:29:53 PM   
MornHyland

 

Posts: 9
Joined: May 2, '05,
Status: offline
I've noticed the device busy on occassion when running a configure script. Though if I run it again they go away, it seems somewhat random.

Julia

_____________________________

Ships are safe inside the harbor but is that what they are really for?

(in reply to Rodney)
Post #: 5
RE: Device Busy - May 4, '05, 2:46:16 PM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
I haven't experienced this happening myself. So I'm curious to try and narrow it down,
Which version of Windows do you have?
Is Interix installed on an NTFS drive and is the disk you are running configure on NTFS?
The configure script that it happened with were for which application?

(in reply to MornHyland)
Post #: 6
RE: Device Busy - May 4, '05, 2:53:13 PM   
MornHyland

 

Posts: 9
Joined: May 2, '05,
Status: offline
I'm running on TabletPC 2005 (Windows XP SP2 basically). The drives are NTFS.

I believe I've seen it with nearly every configure script I've run. But, like I said, I can run the configure script again and it will work fine. Given what I read earlier in this script and a 'feeling' I had before, it seems that it may be related to the configure script rm'ing the temp files it creates to test different things.

Hope that helps.

Julia

_____________________________

Ships are safe inside the harbor but is that what they are really for?

(in reply to Rodney)
Post #: 7
RE: Device Busy - Jun. 7, '05, 8:30:08 PM   
Keehan_Mallon

 

Posts: 32
Joined: Jan. 23, '04,
Status: offline
We are seeing this as well and have been working through this with MS support for months and are just getting to the bottom of the problem. I will take a few excerpts from the case and let you know what we have found.

Basically, what is happending is Interix marks a file for deletion and then another process attempts to open the file before it is actually deleted.

1. Why is the file marked for deletion?

To answer the first question, I note that redirection can imply deleting a file. For example:

echo hello > hello.txt
echo hello > hello.txt

Basically these are the things that we are working on right now is the creation of truely unique temp files. We have tried appending $$ and $random. The problem is lessened by $RANDOM, but even this is getting the same result if the command executes at the exact same time. For example, if you try:

echo "$RANDOM"& echo "$RANDOM"

you will get the same numbers. While if you try

echo "$RANDOM"; echo "$RANDOM"

you will get different numbers.

So, at this point, we are trying to get a better random number generator. This thread has pointed out mktemp(1). If we don't find anything else we may try this tomorrow. I don't like to add to many apps outside of the stock SFU.

Anyway, hope this sheds some more light on the problem and solution. We are still working with MS Support to see if this can be deemed a bug to be fixed or if it is just an edge case where POSIX and windows conflict.

(in reply to MornHyland)
Post #: 8
RE: Device Busy - Oct. 30, '05, 7:10:31 PM   
prj32

 

Posts: 29
Joined: Oct. 16, '04,
Status: offline
Any progress on this one? I am seeing a similar "device busy" problem with running a quite large rsync script (with delete option).

(in reply to Keehan_Mallon)
Post #: 9
RE: Device Busy - Oct. 31, '05, 3:28:01 AM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
You could try sending a message to member Keehan_Mallon to see if there is more
news from the MS Support front. I haven't heard anything on this myself for some while.

I've not run into the problem as as desribed by MornHyland with configure scripts.
But I do understand what Keehan_Mallon is describing. I do know that back in the
Softway-days there was subsystem code to cover this because of the Unix tradition of an
editor creating a file buffer and unlink()ing it so no other process could fiddle with it
(that's part of the "$$psxjunk" thing).
Now whether the code was changed or this is an "edge case" that was not part of the code
I'm afraid I don't know. But if support was working on it for months there must of been
something complex or snakey about it.

When you are running rsync I'm assuming you mean "--delete".
Is it the files that don't exist on sender that are going "device busy" on the recv'er ?
Or is it some other file(s)? <-- always the same files ?? What's the mode/owner ?

(in reply to prj32)
Post #: 10
RE: Device Busy - Oct. 31, '05, 4:11:08 AM   
prj32

 

Posts: 29
Joined: Oct. 16, '04,
Status: offline
I will drop Keehan a line.

Q>> When you are running rsync I'm assuming you mean "--delete".
A>> y

Q>> Is it the files that don't exist on sender that are going "device busy" on the recv'er ?
A>> recv'er - doesn't happen all the time .. just doing some further investigation. More curious about why the "$deleted-1c5db67699f5f0c" failed: Device busy" error occurs.

rsync -av --rsh=ssh --delete $EXCLUDE $SOURCE_DIR $USER@$DEST_SERVER:$DEST_DIR

[output from sender]
readlink "/dev/fs/R/1/a/.$deleted-1c5db67699f5f0c" failed: Device busy
readlink "/dev/fs/R/1/a/.$deleted-1c5db67699f5f0c" failed: Device busy
readlink "/dev/fs/R/1/a/.$deleted-1c5db6e731dbeaf" failed: Device busy
readlink "/dev/fs/R/1/a/.$deleted-1c5db748b847dcd" failed: Device busy
readlink "/dev/fs/R/1/a/.$deleted-1c5db81ecf0a8b5" failed: Device busy
readlink "/dev/fs/R/1/a/1/.$deleted-1c5db6e6b1db756" failed: Device busy
readlink "/dev/fs/R/1/a/2/.$deleted-1c5db6e6b2019b1" failed: Device busy
readlink "/dev/fs/R/1/a/3/1/.$deleted-1c5db7483c01157" failed: Device busy
readlink "/dev/fs/R/1/a/3/2/.$deleted-1c5db74840070f0" failed: Device busy

Q>> Or is it some other file(s)? <-- always the same files ?? What's the mode/owner ?
A>> files vary, user performing the rsync has full perms

(in reply to Rodney)
Post #: 11
RE: Device Busy - Oct. 31, '05, 4:27:13 AM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
> readlink "/dev/fs/R/1/a/.$deleted-1c5db67699f5f0c" failed: Device busy

Ah, a networked drive. That is, the drive, R, is not local to the machine, correct?
Have you tried specifiying the path with the /net filesystem ?

(in reply to prj32)
Post #: 12
RE: Device Busy - Oct. 31, '05, 1:27:47 PM   
Keehan_Mallon

 

Posts: 32
Joined: Jan. 23, '04,
Status: offline
The last notice from support was:

mktemp only returns a unique filename without creating a file. If there are two calls to mktemp at the same time they can both return the same filename. So mktemp still may have the race condition I mentioned before. According to the documentation mkstemp always creates a unique file and that is why I recommended it.

I will file a request to have a utility added to a future version of the product.

I don’t think a hotfix is appropriate at this time since we have a solution around the problem. What I will do instead is file a bug report to have it fixed in a future version of the product and I will also write a knowledge base article to describe the “device busy” issue.


We just ended up appending more bits (PIDs, PPIDs, etc) to get unique identifiers. This is what they were referring to about a "solution". Anyway, it sounds like they are going to try to add a utility to get unique filenames.

Hope this helps,

Keehan

(in reply to Rodney)
Post #: 13
RE: Device Busy - Oct. 31, '05, 1:57:57 PM   
Rodney

 

Posts: 3714
Joined: Jul. 9, '02,
From: /Tools lab
Status: offline
For clarity the /Tools mktemp utility uses mkstemp().

If a utility is going to be added then it would happen with the next release
of Interix which is version 5.2 which is for W2K3/R2 and later releases (e.g.
longhorn/vista).

< Message edited by Rodney -- Oct. 31, '05, 4:39:25 PM >

(in reply to Keehan_Mallon)
Post #: 14
RE: Device Busy - Oct. 31, '05, 4:09:58 PM   
prj32

 

Posts: 29
Joined: Oct. 16, '04,
Status: offline
Nope R is a local volume, well sort of - it's a MSCS managed volume.

(in reply to Rodney)
Post #: 15
Page:   [1]
All Forums >> [SFU / Interix / SUA Technology] >> Interix Advanced Forum >> Device Busy Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts


Search All Forums -

Advanced search


SPONSORS



Forum Software © ASPPlayground.NET Advanced Edition 2.5 ANSI

0.063