EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Deadlock in CbFsSetFileAttributes ?

Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.
#6798
Posted: 07/01/2008 07:30:34
by Søren Kristensen (Basic support level)
Joined: 03/04/2008
Posts: 62

I have the problem that my solution build on Callback File System at times stops. The last function executet is CbFsSetFileAttributes and this returns with no errors. But after this no more callback functions are called and the system stops completely. The only way out is the power switch.

1) Is this a normally behaviour for a deadlock or is there another problem.

2) I had the understanding that a call to SetUseSystemCache(TRUE) would prevent deadlock 100%. But after reading the thread http://www.eldos.com/forum/read.php?FID=13&TID=958&MID=5175&phrase_id=286132#message5175 I am confused - special

Quote

I am sorry but this is not a meaningful report.

There's a limited set of operations that are allowed in callbacks. Doing many things can cause a deadlock. So you must be *very* careful about what you are doing in callbacks. Ideally, in callbacks you should only read/write local information from/to memory, leaving network and disk operations for other thread, which works in background.



Sincerely yours,
Eugene Mayevski


make me wonder, as this stats that the mapper sample can deadlock.

3) The code part in CbFsSetFileAttributes
Code
        if(CreationTime != NULL)
        {
            CreationPtr = CreationTime;
        }

        if(LastAccessTime != NULL)
        {
            LastAccessPtr = LastAccessTime;
        }

        if(LastWriteTime != NULL)
        {
            LastWritePtr = LastWriteTime;
        }


does not make sense for me. Would the result not be the same if e.g. CreationTime was used directly ??.


Any kind of help will be appreciate.
#6799
Posted: 07/01/2008 09:02:32
by Volodymyr Zinin (EldoS Corp.)

Quote
Søren Kristensen wrote:
1) Is this a normally behaviour for a deadlock or is there another problem.

I don't know. It's more preferable if you give us a sample that causes the problem. Or at least specify what do you do in the CbFsSetFileAttributes callback.
And could you perform the following:
1. Install the checked (i.e. debug) version of the driver from the latest build.
2. Set in the system "Startup and Recovery" settings to generate a "kernel memory" crash dump (for details see the CallbackFS documentation).
3. Run the attached to this message program (it's called BANG! and was taken from osronline.com).
4. Run your CallbackFS implementation. And when the deadlock occurs then use BANG! to generate a BSOD.
5. After the computer reboots, send me the crash dump. It will be quite big (for about 70Mb).
Thanks.

Quote
Søren Kristensen wrote:
2) I had the understanding that a call to SetUseSystemCache(TRUE) would prevent deadlock 100%. But after reading the thread http://www.eldos.com/forum/read.php?F...essage5175 I am confused - special

Unfortunately some operations in the callbacks are not possible due to high cohesion of CallbackFS with the system. If it's necessary to perform something that causes a deadlock (for example writing to the debug console from the read or write callbacks or showing GUI-windows) then do it asynchronously from other threads.

Quote
Søren Kristensen wrote:
3) The code part in CbFsSetFileAttributes Code
...
does not make sense for me. Would the result not be the same if e.g. CreationTime was used directly ??.

Yes. I also think so. We'll correct it. Thanks.


[ Download ]
#6806
Posted: 07/01/2008 12:07:50
by Søren Kristensen (Basic support level)
Joined: 03/04/2008
Posts: 62

Do you have any documentation on what operationers are okay and what will give deadlocks in relation to the different callback functions ?

You give examples but in some way I have to make a 100% deadlock free solution - and I do not think that "try and error" is the way towards this.

I will return with the BSOD.

Thanks.
#6810
Posted: 07/01/2008 15:55:01
by Volodymyr Zinin (EldoS Corp.)

Quote
Søren Kristensen wrote:
Do you have any documentation on what operationers are okay and what will give deadlocks in relation to the different callback functions ?

No, we don't. But it's safe to use operations that are "simple", i.e. only do some strict and simple work. For example a lot of stdlib functions, file i/o api, socket functions, etc. In opposite the functions like CreateProcess, OutputDebugString, MessageBox, etc are complicated - they internally communicate with different system components such as system services, etc. Perhaps some resource have been locked before or during some request to a CallbackFS storage and this resource will be released only when the request finishes. If in the callback (that is called to process the request) the same resource is tried to lock then a deadlock occurs. Sure the problem does not exist if these functions are called asynchronously.
Also it's easy to generate a deadlock if from a callback that is being processed a request from some CallbackFS storage, perform a request to the same CallbackFS storage (to the same file or directory). The latest request often will never finish because requests to the same file are consecutive and the callback for processing the previous request is being called already.
#6818
Posted: 07/02/2008 05:40:02
by Søren Kristensen (Basic support level)
Joined: 03/04/2008
Posts: 62

Here is the crash dump:

http://mediaconnex.pine.dk/Files/Dump/eldos/MEMORY_PINE.zip

The core of the CbFsSetFileAttributes is from the mapper sample. In some way I do not believe that CbFsSetFileAttributes is the problem.

It was very differcult to get the error/problem with the debug-driver installed - so there are properly some timining issues involved.

I hop you can get some answers from the dump-file.

By the way - do you have some standard way to send/upload big files ?

Thanks.
#6820
Posted: 07/02/2008 06:59:55
by Søren Kristensen (Basic support level)
Joined: 03/04/2008
Posts: 62

I have made another dump:

http://mediaconnex.pine.dk/Files/Dump/eldos/MEMORY_PINE_NO_PRINT.zip

you wrote about printout/debug. I use printf and fprintf to write logging information. The logging mechanism was disabled when this dump was generated.

Hopes this helps.

Thanks.
#6823
Posted: 07/02/2008 07:50:50
by Volodymyr Zinin (EldoS Corp.)

I've downloaded the dumps and will examine them now. Thanks.

Quote
Søren Kristensen wrote:
By the way - do you have some standard way to send/upload big files ?

Either by means of some public file servers (like rapidshare.com) or by uploading to my private FTP server. In the latter case I'll give the server details when it's necessary.
#6826
Posted: 07/02/2008 15:54:32
by Volodymyr Zinin (EldoS Corp.)

The crash dumps have helped. There is a bug in the CallbackFS driver. I'm going to fix it tomorrow.
Thanks again!
#6831
Posted: 07/03/2008 05:57:35
by Volodymyr Zinin (EldoS Corp.)

I've corrected the code. Please try the attached driver. It has the version 0.0.0.0.


[ Download ]
#6833
Posted: 07/03/2008 08:26:56
by Søren Kristensen (Basic support level)
Joined: 03/04/2008
Posts: 62

I also had a crash with the new driver. The dump can be downloaded from

http://mediaconnex.pine.dk/Files/Dump/eldos/MEMORY_PINE_VER0000.zip

Could you give some identification of what kind of bug you are fixing - so I could get some picture of the problem we are having.

Thanks.
Also by EldoS: RawDisk
Access locked and protected files in Windows, read and write disks and partitions and more.

Reply

Statistics

Topic viewed 10194 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!