Re: exception in windows while using FilePageStore

2021-11-18 Thread Ernesto Reinaldo Barreiro
https://issues.apache.org/jira/browse/WICKET-6936

On Thu, Nov 18, 2021 at 1:10 PM Ernesto Reinaldo Barreiro <
reier...@gmail.com> wrote:

> Hi Sven,
>
> Many thanks for your answer.
>
> On Thu, Nov 18, 2021 at 12:36 PM Sven Meier  wrote:
>
>> Hi Ernesto,
>>
>> I've tested FilePageStore without TRUNCATE_EXISTING - in that case the
>> file will not shrink, when the page has reduced its size.
>>
> Ok.
>
>>
>> Luckily this doesn't disturb Java's default deserialization, the excess
>> is just ignored.
>> But what if a project uses another serializer?
>>
>> Good point. For us something like this will be enough:
>
> https://github.com/apache/wicket/pull/484
>
>
>
>> Regards
>>
>> Sven
>>
>>
>> On 17.11.21 10:57, Ernesto Reinaldo Barreiro wrote:
>> > Hi Sven,
>> >
>> > Getting rid of the StandardOpenOption.TRUNCATE_EXISTING here
>> >
>> >
>> https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/pageStore/FilePageStore.java#L189
>> >
>> > seems to "fix" the problem in windows and I also do not see problems in
>> > linux. To be honest I have no idea of the full implications of this
>> change.
>> >
>> >
>> >
>> > On Tue, Nov 16, 2021 at 11:40 PM Sven Meier  wrote:
>> >
>> >> Hi Ernesto,
>> >>
>> >> I'm no expert in this, but as I understood it FileChannel should be
>> save
>> >> to be written to in parallel:
>> >>
>> >>
>> >>
>> https://docs.oracle.com/javase/1.5.0/docs/api/java/nio/channels/FileChannel.html
>> >>
>> >> "File channels are safe for use by multiple concurrent threads. ...
>> >> Only one operation that involves the channel's position or can change
>> >> its file's size may be in progress at any given time; attempts to
>> >> initiate a second such operation while the first is still in progress
>> >> will block until the first operation completes. ... The view of a file
>> >> provided by an instance of this class is guaranteed to be consistent
>> >> with other views of the same file provided by other instances in the
>> >> same program."
>> >>
>> >> This sounds related though:
>> >>
>> >>
>> >>
>> https://stackoverflow.com/questions/45441249/why-does-java-filechannel-truncate-fail-predictably-on-windows-only
>> >>
>> >> Regards
>> >> Sven
>> >>
>> >>
>> >> On 16.11.21 19:56, Ernesto Reinaldo Barreiro wrote:
>> >>> Hi Sven,
>> >>>
>> >>> Many thanks for your answer. Main problem is I do not have Windows
>> >>> around... this happens only in our Jenkins (which needs to be a
>> windows
>> >>> machine). I did some googling around and it seems it can be the
>> operating
>> >>> system itself if you access the same file in a very fast sequence:
>> this
>> >>> might be our case, as we are generating many web sockets messages
>> >> (pushing
>> >>> components) and this seems to trigger page serialization.
>> >>>
>> >>> On Linux and Mac we have no problems at all.
>> >>>
>> >>>
>> >>> On Tue, Nov 16, 2021 at 7:28 PM Sven Meier  wrote:
>> >>>
>>  Hi Ernesto,
>> 
>>  maybe an issue with concurrent file writes?
>> 
>>  I've tested the new FilePageStore on Linux only, and as it seems I
>>  didn't add any synchronization to it.
>> 
>>  Could you try out FilePageStoreTest?
>> 
>>  Regards
>>  Sven
>> 
>> 
>>  On 16.11.21 16:18, Ernesto Reinaldo Barreiro wrote:
>> > Hi,
>> >
>> > We are trying to use FilePageStore and we are getting following
>> > exception (a lot of them actually)
>> >
>> > he requested operation cannot be performed on a file with a
>> user-mapped
>> > section open
>> > [2021-11-16T07:34:00.699Z] at
>> >
>> >>
>> sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
>> > ~[?:?]
>> > [2021-11-16T07:34:00.699Z] at
>> >
>> >>
>> sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
>> > ~[?:?]
>> > [2021-11-16T07:34:00.699Z] at
>> >
>> >>
>> sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
>> > ~[?:?]
>> > [2021-11-16T07:34:00.699Z] at
>> >
>> >>
>> sun.nio.fs.WindowsFileSystemProvider.newFileChannel(WindowsFileSystemProvider.java:121)
>> > ~[?:?]
>> > [2021-11-16T07:34:00.699Z] at
>> > java.nio.channels.FileChannel.open(FileChannel.java:298) ~[?:?]
>> > [2021-11-16T07:34:00.699Z] at
>> > java.nio.channels.FileChannel.open(FileChannel.java:357) ~[?:?]
>> > [2021-11-16T07:34:00.699Z] at
>> >
>> >>
>> org.apache.wicket.pageStore.FilePageStore.writeFile(FilePageStore.java:188)
>> > [wicket-core-9.6.0.jar:9.6.0]
>> > [2021-11-16T07:34:00.699Z] at
>> >
>> >>
>> org.apache.wicket.pageStore.FilePageStore.addPersistedPage(FilePageStore.java:178)
>> > [wicket-core-9.6.0.jar:9.6.0]
>> > [2021-11-16T07:34:00.699Z] at
>> >
>> >>
>> org.apache.wicket.pageStore.AbstractPersistentPageStore.addPage(AbstractPersistentPageStore.java:128)
>> > [wicket-core-9.6.0.jar:9.6.0]
>> > [2021-11-16T07:34:00.699Z] at
>> >
>> >>
>> org.apache.

Re: exception in windows while using FilePageStore

2021-11-18 Thread Ernesto Reinaldo Barreiro
Hi Sven,

Many thanks for your answer.

On Thu, Nov 18, 2021 at 12:36 PM Sven Meier  wrote:

> Hi Ernesto,
>
> I've tested FilePageStore without TRUNCATE_EXISTING - in that case the
> file will not shrink, when the page has reduced its size.
>
Ok.

>
> Luckily this doesn't disturb Java's default deserialization, the excess
> is just ignored.
> But what if a project uses another serializer?
>
> Good point. For us something like this will be enough:

https://github.com/apache/wicket/pull/484



> Regards
>
> Sven
>
>
> On 17.11.21 10:57, Ernesto Reinaldo Barreiro wrote:
> > Hi Sven,
> >
> > Getting rid of the StandardOpenOption.TRUNCATE_EXISTING here
> >
> >
> https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/pageStore/FilePageStore.java#L189
> >
> > seems to "fix" the problem in windows and I also do not see problems in
> > linux. To be honest I have no idea of the full implications of this
> change.
> >
> >
> >
> > On Tue, Nov 16, 2021 at 11:40 PM Sven Meier  wrote:
> >
> >> Hi Ernesto,
> >>
> >> I'm no expert in this, but as I understood it FileChannel should be save
> >> to be written to in parallel:
> >>
> >>
> >>
> https://docs.oracle.com/javase/1.5.0/docs/api/java/nio/channels/FileChannel.html
> >>
> >> "File channels are safe for use by multiple concurrent threads. ...
> >> Only one operation that involves the channel's position or can change
> >> its file's size may be in progress at any given time; attempts to
> >> initiate a second such operation while the first is still in progress
> >> will block until the first operation completes. ... The view of a file
> >> provided by an instance of this class is guaranteed to be consistent
> >> with other views of the same file provided by other instances in the
> >> same program."
> >>
> >> This sounds related though:
> >>
> >>
> >>
> https://stackoverflow.com/questions/45441249/why-does-java-filechannel-truncate-fail-predictably-on-windows-only
> >>
> >> Regards
> >> Sven
> >>
> >>
> >> On 16.11.21 19:56, Ernesto Reinaldo Barreiro wrote:
> >>> Hi Sven,
> >>>
> >>> Many thanks for your answer. Main problem is I do not have Windows
> >>> around... this happens only in our Jenkins (which needs to be a windows
> >>> machine). I did some googling around and it seems it can be the
> operating
> >>> system itself if you access the same file in a very fast sequence: this
> >>> might be our case, as we are generating many web sockets messages
> >> (pushing
> >>> components) and this seems to trigger page serialization.
> >>>
> >>> On Linux and Mac we have no problems at all.
> >>>
> >>>
> >>> On Tue, Nov 16, 2021 at 7:28 PM Sven Meier  wrote:
> >>>
>  Hi Ernesto,
> 
>  maybe an issue with concurrent file writes?
> 
>  I've tested the new FilePageStore on Linux only, and as it seems I
>  didn't add any synchronization to it.
> 
>  Could you try out FilePageStoreTest?
> 
>  Regards
>  Sven
> 
> 
>  On 16.11.21 16:18, Ernesto Reinaldo Barreiro wrote:
> > Hi,
> >
> > We are trying to use FilePageStore and we are getting following
> > exception (a lot of them actually)
> >
> > he requested operation cannot be performed on a file with a
> user-mapped
> > section open
> > [2021-11-16T07:34:00.699Z] at
> >
> >>
> sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)
> > ~[?:?]
> > [2021-11-16T07:34:00.699Z] at
> >
> >>
> sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
> > ~[?:?]
> > [2021-11-16T07:34:00.699Z] at
> >
> >>
> sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
> > ~[?:?]
> > [2021-11-16T07:34:00.699Z] at
> >
> >>
> sun.nio.fs.WindowsFileSystemProvider.newFileChannel(WindowsFileSystemProvider.java:121)
> > ~[?:?]
> > [2021-11-16T07:34:00.699Z] at
> > java.nio.channels.FileChannel.open(FileChannel.java:298) ~[?:?]
> > [2021-11-16T07:34:00.699Z] at
> > java.nio.channels.FileChannel.open(FileChannel.java:357) ~[?:?]
> > [2021-11-16T07:34:00.699Z] at
> >
> >>
> org.apache.wicket.pageStore.FilePageStore.writeFile(FilePageStore.java:188)
> > [wicket-core-9.6.0.jar:9.6.0]
> > [2021-11-16T07:34:00.699Z] at
> >
> >>
> org.apache.wicket.pageStore.FilePageStore.addPersistedPage(FilePageStore.java:178)
> > [wicket-core-9.6.0.jar:9.6.0]
> > [2021-11-16T07:34:00.699Z] at
> >
> >>
> org.apache.wicket.pageStore.AbstractPersistentPageStore.addPage(AbstractPersistentPageStore.java:128)
> > [wicket-core-9.6.0.jar:9.6.0]
> > [2021-11-16T07:34:00.699Z] at
> >
> >>
> org.apache.wicket.pageStore.AsynchronousPageStore$PageAddingRunnable.run(AsynchronousPageStore.java:292)
> > [wicket-core-9.6.0.jar:9.6.0]
> > [2021-11-16T07:34:00.699Z] at java.lang.Thread.run(Thread.java:833)
> >> [?:?]
> > This does not happen for other operating systems. Is this a known
> > limitat

Re: exception in windows while using FilePageStore

2021-11-18 Thread Sven Meier

Hi Ernesto,

I've tested FilePageStore without TRUNCATE_EXISTING - in that case the 
file will not shrink, when the page has reduced its size.


Luckily this doesn't disturb Java's default deserialization, the excess 
is just ignored.

But what if a project uses another serializer?

Regards

Sven


On 17.11.21 10:57, Ernesto Reinaldo Barreiro wrote:

Hi Sven,

Getting rid of the StandardOpenOption.TRUNCATE_EXISTING here

https://github.com/apache/wicket/blob/master/wicket-core/src/main/java/org/apache/wicket/pageStore/FilePageStore.java#L189

seems to "fix" the problem in windows and I also do not see problems in
linux. To be honest I have no idea of the full implications of this change.



On Tue, Nov 16, 2021 at 11:40 PM Sven Meier  wrote:


Hi Ernesto,

I'm no expert in this, but as I understood it FileChannel should be save
to be written to in parallel:


https://docs.oracle.com/javase/1.5.0/docs/api/java/nio/channels/FileChannel.html

"File channels are safe for use by multiple concurrent threads. ...
Only one operation that involves the channel's position or can change
its file's size may be in progress at any given time; attempts to
initiate a second such operation while the first is still in progress
will block until the first operation completes. ... The view of a file
provided by an instance of this class is guaranteed to be consistent
with other views of the same file provided by other instances in the
same program."

This sounds related though:


https://stackoverflow.com/questions/45441249/why-does-java-filechannel-truncate-fail-predictably-on-windows-only

Regards
Sven


On 16.11.21 19:56, Ernesto Reinaldo Barreiro wrote:

Hi Sven,

Many thanks for your answer. Main problem is I do not have Windows
around... this happens only in our Jenkins (which needs to be a windows
machine). I did some googling around and it seems it can be the operating
system itself if you access the same file in a very fast sequence: this
might be our case, as we are generating many web sockets messages

(pushing

components) and this seems to trigger page serialization.

On Linux and Mac we have no problems at all.


On Tue, Nov 16, 2021 at 7:28 PM Sven Meier  wrote:


Hi Ernesto,

maybe an issue with concurrent file writes?

I've tested the new FilePageStore on Linux only, and as it seems I
didn't add any synchronization to it.

Could you try out FilePageStoreTest?

Regards
Sven


On 16.11.21 16:18, Ernesto Reinaldo Barreiro wrote:

Hi,

We are trying to use FilePageStore and we are getting following
exception (a lot of them actually)

he requested operation cannot be performed on a file with a user-mapped
section open
[2021-11-16T07:34:00.699Z] at


sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:92)

~[?:?]
[2021-11-16T07:34:00.699Z] at


sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)

~[?:?]
[2021-11-16T07:34:00.699Z] at


sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)

~[?:?]
[2021-11-16T07:34:00.699Z] at


sun.nio.fs.WindowsFileSystemProvider.newFileChannel(WindowsFileSystemProvider.java:121)

~[?:?]
[2021-11-16T07:34:00.699Z] at
java.nio.channels.FileChannel.open(FileChannel.java:298) ~[?:?]
[2021-11-16T07:34:00.699Z] at
java.nio.channels.FileChannel.open(FileChannel.java:357) ~[?:?]
[2021-11-16T07:34:00.699Z] at


org.apache.wicket.pageStore.FilePageStore.writeFile(FilePageStore.java:188)

[wicket-core-9.6.0.jar:9.6.0]
[2021-11-16T07:34:00.699Z] at


org.apache.wicket.pageStore.FilePageStore.addPersistedPage(FilePageStore.java:178)

[wicket-core-9.6.0.jar:9.6.0]
[2021-11-16T07:34:00.699Z] at


org.apache.wicket.pageStore.AbstractPersistentPageStore.addPage(AbstractPersistentPageStore.java:128)

[wicket-core-9.6.0.jar:9.6.0]
[2021-11-16T07:34:00.699Z] at


org.apache.wicket.pageStore.AsynchronousPageStore$PageAddingRunnable.run(AsynchronousPageStore.java:292)

[wicket-core-9.6.0.jar:9.6.0]
[2021-11-16T07:34:00.699Z] at java.lang.Thread.run(Thread.java:833)

[?:?]

This does not happen for other operating systems. Is this a known
limitation? Is there anything else that needs to be configured at

operating

system level?

Thanks in advance.


-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org



-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org




-
To unsubscribe, e-mail: users-unsubscr...@wicket.apache.org
For additional commands, e-mail: users-h...@wicket.apache.org