EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Timeout and callbacks

Also by EldoS: CallbackRegistry
A component to monitor and control Windows registry access and create virtual registry keys.
#23578
Posted: 02/20/2013 08:11:11
by Simon Hailes (Basic support level)
Joined: 02/19/2013
Posts: 1

Could someone confirm the section from the helpfile:
"Timeouts

All callback functions must perform fast in order not to block the whole system. To prevent blocking the driver uses timeouts.

The timeout value is set globally as a parameter of MountMedia method. If the user-mode process takes too much time to process the callback request and timeout expires, the driver cancels the request and reports error to the OS.

If some callback needs more time to complete the operation, it can call ResetTimeout method for this particular call.

To make your code fast, don't perform lengthy operations (especially network
operations) from the callback. Create a worker thread, that will do the job.
When you need to write the data, pass this data to the worker thread and return. The worker thread will send the data to the remote side. When the file is opened, cache some of it's data with help of the worker thread and return this data from reading callback."


I wish to do web accesses from the read function, but this seems to indicate that it will not work as expected; yet the sftpdisk does precisely this?
Will I hit problems if I'm reading a section of file from an HTTP address and my read callback takes some time to return?

Simon
#23590
Posted: 02/21/2013 01:18:54
by Volodymyr Zinin (EldoS Corp.)

Actually the CallbackFS timeout mechanism was implemented to avoid possible deadlocks in the system, because of possible complication in interaction between CallbackFS, Windows, and user implementation of the CallbackFS callbacks.
I.e. if something in your callback implementation causes a deadlock then CallbackFS "breakdowns" the deadlock (by finishing the original request with the "timeout" error). Of course it is not good either but much better than the deadlock. And in the case of "correct" implementation of the callbacks the timeout mechanism is never triggers.
Moreover during the development it's recommended to switch the timeouts off (to set the Timeout parameter of the MountMedia call to 0). It helps to prevent timeouts when you trace/debug your CallbackFS callback code in the debugger.

Quote
Simon Hailes wrote:
I wish to do web accesses from the read function, but this seems to indicate that it will not work as expected; yet the sftpdisk does precisely this? Will I hit problems if I'm reading a section of file from an HTTP address and my read callback takes some time to return?

That was just a recommendation to use an "intermediate" local cache in order to minimize quantity of code in the callbacks. Of course you can do direct read request to a remote file from callbacks.

Reply

Statistics

Topic viewed 856 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!