[jsword-devel] Upgrade module - delete then install problem

Chris Burrell chris at burrell.me.uk
Thu Feb 20 16:15:32 MST 2014


Java IO typically delegates to os (as most apps do) for most things. Which
can cache io operations for some time and gives no guarantee of when
operation is happening according to java doc.

For writes you can force the os by getting a file descriptor and calling
sync on it. That forces the jvm to wait and calls a synchronous operation
at os layer. Actually it forces the os to wait on the disk operation.i
think the c equivalent is fsync but can't remember if that's exactly the
same anymore.

The same mechanism probably applies to delete operations add they concern
file descriptors and interaction with hard disk hardware.

Might not be the problem but that's the first thing is look at.

Chris
 On 20 Feb 2014 22:44, "Martin Denham" <mjdenham at gmail.com> wrote:

> I have been analyzing occasional And Bible module upgrade problems today.
>  DM - you observed this while attempting to upgrade KJV recently.
>
> Upgrade consists of:
> 1. delete installed module (book.getDriver().delete(book);)
> 2. install new module
>
> However about half the time an error occurs on step 2 in IOUtil.unpackZip
> on the following line:
>      if (!parentDir.mkdirs()) {
> This error never occurs when installing a new module so it is related to
> removal of the previous version of the module.
>
> I can't really work out why that call sometimes fails during module
> upgrade and the only idea I have come up with is "Java is known not to
> delete files immediately, so mkdir may fail sometimes" (
> http://stackoverflow.com/questions/617414/create-a-temporary-directory-in-java).
>  What do you think of that reason?  I have never knowingly observed this
> delay in deletion and the above is the only mention I have seen of this
> problem.
>
> I have a sort-of work around for the above problem which is
> 1. remove module from JSword lists without deleting files
> (Books.installed().removeBook(book);)
> 2. install new module (overwriting previous files)
> Do module file names ever change in later versions?  Are there any other
> potential problems?
>
> There also seems to be a minor bug in Books.removeBook() which has;
>      names.put(book.getName(), book);
> which I believe should be:
>      names.remove(book.getName());
> but this does not appear to cause any problems.
>
> Martin
>
>
>
>
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.crosswire.org/pipermail/jsword-devel/attachments/20140220/66c26bbd/attachment.html>


More information about the jsword-devel mailing list