Catch a file open for writing error exception

Asked by Bartek

Hello again,

Recently i was testing some dev versions of 105 client with broken file download recovery functions (first version, and the last branch). I was making some test, with deleting layout files, content files etc.
Some times on screen appear a runtime error, that file cannot be opened becouse other process opened it already (xxx.mpeg - my movie file)
Probably with normal usage situation this error should never appear and it's appeared becouse deletion of some random files after client shutdown an before opening it again etc. Maybe some sequence of event tooks place that was not supposed to happen in normal operation. Or maybe windows was genrating thumbs etc. Probably the same situation will appear when there will be no more free disk space etc.

But maybe regardless of that its a good conception to generally catch those file open for writing error (with exception for logfile ofcourse -that could be hard to log :)) and log them instead of displaying .net error on screen forever :)
For example a would prefer a some broken files on client that still running rest of content that was downloaded correctly, than client with beautiful error on screen center...

Later maybe marking files with writing error as unusable in memory (and maybe try to write them again on the end of queue etc) is worth of consideration, but in stable branch probably not a good idea.

Of course best idea is to predict all possible situations ;) but it's probably impossible (filesystem errors, some antiviruses file actions, everything else etc) :)

Question information

Language:
English Edit question
Status:
Answered
For:
Xibo Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
Bartek (czajka) said :
#1

Some additional question about dev version:

You've changed static version 2.0.0.0 to 1.0.5.0 to reflect true bin revision.
My test xibo installation dropped all settings due to version change (different folder is used now in Application Data and Local Prefs)
Will be there need to reconfigure all clients manually after version update? Or maybe installer will read settings correctly? (Right now i'm using copy - paste from Release to Program Files becouse vb express complains about some certificate and workaround for this doesn't work for me)

Revision history for this message
Alex Harrington (alexharrington) said :
#2

Hi Bartek

It's really helpful if you can keep to one question per thread. It makes it easier for people searching for things to find the answers they're looking for.

Dan will be able to give authoritative answers on both these points, but here's my views:

On the first point, yes, of course we should catch every possible exception BUT here you're testing code for something it's not been designed to do.

The bug that's being fixed is that the client checks that the files it downloads are not corrupted and arranges to download them again if they are. If you're merrily deleting files from under the running client then it's quite possible you end up confusing the client in to a situation where it does try and write a file it has open already. Simply don't do that.

Alex

Revision history for this message
Bartek (czajka) said :
#3

Hi,

Files were deleted only when client was turned off. But file deletion sequence was quite random and probably should never happen in normal operation - first file in queue gone, second partialy downloaded, etc. Right now i can't reproduce situation that caused this error, as i said maybe windows locked some files for a while.
Ok, no problem with question per subject.

Revision history for this message
Dan Garner (dangarner) said :
#4

Bartek,

Regarding the settings - I thought this might happen with the version
change. I am currently looking into persisting the settings and will have a
solution before releasing.

Cheers,
Dan

2009/12/6 Bartek <email address hidden>

> Question #93060 on Xibo changed:
> https://answers.launchpad.net/xibo/+question/93060
>
> Bartek posted a new comment:
> Some additional question about dev version:
>
> You've changed static version 2.0.0.0 to 1.0.5.0 to reflect true bin
> revision.
> My test xibo installation dropped all settings due to version change
> (different folder is used now in Application Data and Local Prefs)
> Will be there need to reconfigure all clients manually after version
> update? Or maybe installer will read settings correctly? (Right now i'm
> using copy - paste from Release to Program Files becouse vb express
> complains about some certificate and workaround for this doesn't work for
> me)
>
> --
> You received this question notification because you are a member of Xibo
> Developers, which is an answer contact for Xibo.
>

Can you help with this problem?

Provide an answer of your own, or ask Bartek for more information if necessary.

To post a message you must log in.