You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@poi.apache.org by Avik Sengupta <av...@apache.org> on 2003/06/13 18:41:31 UTC

RE: Concurrency Issue

[moving to poi dev]
I have now confirmed this issue. A simple program reading different xls
files in different threads using different instances of PoifsFileSystem
and HSSFWorkbook fails. 

I am currently unable to say further why this is so, since a quick look
at both POIFSFileSystem and HSSFWorkbook show no instances of static
data. Will look into this further. 

Regards
-
Avik


On Wed, 2003-05-14 at 14:41, Avik Sengupta wrote:
> I do not believe there are static stuff which precludes reading many
> files at a go, but i could be wrong. 
> 
> I would actually guess that one particular file of yours is throwing up
> some pre-existing bug in poi. Have you checked that all the files you
> want to open can be opened sequentially in poi?
> 
> On Tue, 2003-05-13 at 22:38, Vilay.Wadhwa@ubsw.com wrote:
> > Hi Avik,
> > 
> > Thanks a lot for the response.
> > I am creating diff. HSSFWorkBook for diff. uploaded files via diff. threads.
> > But for some reason one of the WorkBook constructor fails.
> > 
> > Can you please let me know if we have any limit on reading the files concurrently
> > or any other part of the code( static stuff ) that may be causing this issue.
> > 
> > By the way, can I have your contact # or do you prefer to have my contact # and 
> > we can have a quick chat.
> > 
> > Cheers
> > Vilay
> > 
> > 
> > -----Original Message-----
> > From: Avik Sengupta [mailto:avik@apache.org]
> > Sent: Tuesday, May 13, 2003 5:53 AM
> > To: POI Users List
> > Subject: Re: Concurrency Issue
> > 
> > 
> > you cannot use a single HSSFWorkbook object from more than one thread.
> > you will need to synchronise access to that object. Of course, you can
> > use different HSSFWorkbook objects in different threads concurrently. 
> > 
> > 
> > 
> > On Tue, 2003-05-13 at 02:00, Vilay.Wadhwa@ubsw.com wrote:
> > > Hi Guys,
> > > 
> > > I am having problem reading more than one file Excel files concurrently.
> > > Reading individual files seem to be fine.
> > > 
> > > The exception I get is as follows:
> > > 
> > > java.lang.reflect.InvocationTargetException: java.lang.ArrayIndexOutOfBoundsException
> > > 	at org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java:557)
> > > 	at org.apache.poi.util.LittleEndian.getInt(LittleEndian.java:177)
> > > 	at org.apache.poi.hssf.record.DimensionsRecord.fillFields(DimensionsRecord.java:121)
> > > 	at org.apache.poi.hssf.record.Record.fillFields(Record.java:143)
> > > 	at org.apache.poi.hssf.record.Record.<init>(Record.java:105)
> > > 	at org.apache.poi.hssf.record.DimensionsRecord.<init>(DimensionsRecord.java:94)
> > > 	at java.lang.reflect.Constructor.newInstance(Native Method)
> > > 	at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:254)
> > > 	at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:192)
> > > 	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:191)
> > > 	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:158)
> > > 	
> > > 
> > > 
> > > Your help is highly appreciated.
> > > 
> > > Best Regards,
> > > Vilay
> > > 
> > > Visit our website at http://www.ubswarburg.com
> > > 
> > > This message contains confidential information and is intended only 
> > > for the individual named.  If you are not the named addressee you 
> > > should not disseminate, distribute or copy this e-mail.  Please 
> > > notify the sender immediately by e-mail if you have received this 
> > > e-mail by mistake and delete this e-mail from your system.
> > > 
> > > E-mail transmission cannot be guaranteed to be secure or error-free 
> > > as information could be intercepted, corrupted, lost, destroyed, 
> > > arrive late or incomplete, or contain viruses.  The sender therefore 
> > > does not accept liability for any errors or omissions in the contents 
> > > of this message which arise as a result of e-mail transmission.  If 
> > > verification is required please request a hard-copy version.  This 
> > > message is provided for informational purposes and should not be 
> > > construed as a solicitation or offer to buy or sell any securities or 
> > > related financial instruments.
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> > > 
> > 
> > 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> > 
> > 
> > Visit our website at http://www.ubswarburg.com
> > 
> > This message contains confidential information and is intended only 
> > for the individual named.  If you are not the named addressee you 
> > should not disseminate, distribute or copy this e-mail.  Please 
> > notify the sender immediately by e-mail if you have received this 
> > e-mail by mistake and delete this e-mail from your system.
> > 
> > E-mail transmission cannot be guaranteed to be secure or error-free 
> > as information could be intercepted, corrupted, lost, destroyed, 
> > arrive late or incomplete, or contain viruses.  The sender therefore 
> > does not accept liability for any errors or omissions in the contents 
> > of this message which arise as a result of e-mail transmission.  If 
> > verification is required please request a hard-copy version.  This 
> > message is provided for informational purposes and should not be 
> > construed as a solicitation or offer to buy or sell any securities or 
> > related financial instruments.
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> > 
> 
-- 
Avik Sengupta <av...@apache.org>


Re: Concurrency Issue

Posted by Avik Sengupta <av...@apache.org>.
Holy shit indeed. I tried to find all instances static fields, but a
textual search for the word static produced so many responses that i
couldnt find anything sensible in the forrest. Oh for the day when i can
do contextual searches on code .. does IDEA do this?... maybe we should
go back to LISP :)

On Fri, 2003-06-27 at 02:58, Andrew C. Oliver wrote:
> Holy shit...  You're right....  And no one noticed before now!  Freaky.  You
> fixing it?  If not tell me, I'll do it pronto...
> 
> BTW, can you fix the stuff you broke in the build?
> 
> -andy
> 
> On 6/26/03 5:08 PM, "Ryan Ackley" <sa...@cfl.rr.com> wrote:
> 
> > doh! Found the problem, LittleEndian uses static byte arrays when it reads
> > from a stream.
> > 
> > Ryan
> > 
> > ----- Original Message -----
> > From: "Ryan Ackley" <sa...@cfl.rr.com>
> > To: "POI Developers List" <po...@jakarta.apache.org>
> > Sent: Thursday, June 26, 2003 3:36 PM
> > Subject: Re: Concurrency Issue
> > 
> > 
> >> Not sure about my previous theory anymore, it would throw an exception if
> > it
> >> had a problem reading a block of data, still investigating...
> >> 
> >> 
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: poi-dev-help@jakarta.apache.org
> >> 
> > 
> > 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: poi-dev-help@jakarta.apache.org
> > 
-- 
Avik Sengupta <av...@apache.org>


Re: Concurrency Issue

Posted by Ryan Ackley <sa...@cfl.rr.com>.
Planning on fixing the build later tonight. I'm fixing dinner right now, so
go ahead and fix LittleEndian.

Ryan

----- Original Message ----- 
From: "Andrew C. Oliver" <ac...@apache.org>
To: "POI Developers List" <po...@jakarta.apache.org>
Sent: Thursday, June 26, 2003 5:28 PM
Subject: Re: Concurrency Issue


> Holy shit...  You're right....  And no one noticed before now!  Freaky.
You
> fixing it?  If not tell me, I'll do it pronto...
>
> BTW, can you fix the stuff you broke in the build?
>
> -andy
>
> On 6/26/03 5:08 PM, "Ryan Ackley" <sa...@cfl.rr.com> wrote:
>
> > doh! Found the problem, LittleEndian uses static byte arrays when it
reads
> > from a stream.
> >
> > Ryan
> >
> > ----- Original Message -----
> > From: "Ryan Ackley" <sa...@cfl.rr.com>
> > To: "POI Developers List" <po...@jakarta.apache.org>
> > Sent: Thursday, June 26, 2003 3:36 PM
> > Subject: Re: Concurrency Issue
> >
> >
> >> Not sure about my previous theory anymore, it would throw an exception
if
> > it
> >> had a problem reading a block of data, still investigating...
> >>
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> >> For additional commands, e-mail: poi-dev-help@jakarta.apache.org
> >>
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: poi-dev-help@jakarta.apache.org
> >
>
> -- 
> Andrew C. Oliver
> http://www.superlinksoftware.com/poi.jsp
> Custom enhancements and Commercial Implementation for Jakarta POI
>
> http://jakarta.apache.org/poi
> For Java and Excel, Got POI?
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-dev-help@jakarta.apache.org
>


Re: Concurrency Issue

Posted by "Andrew C. Oliver" <ac...@apache.org>.
Holy shit...  You're right....  And no one noticed before now!  Freaky.  You
fixing it?  If not tell me, I'll do it pronto...

BTW, can you fix the stuff you broke in the build?

-andy

On 6/26/03 5:08 PM, "Ryan Ackley" <sa...@cfl.rr.com> wrote:

> doh! Found the problem, LittleEndian uses static byte arrays when it reads
> from a stream.
> 
> Ryan
> 
> ----- Original Message -----
> From: "Ryan Ackley" <sa...@cfl.rr.com>
> To: "POI Developers List" <po...@jakarta.apache.org>
> Sent: Thursday, June 26, 2003 3:36 PM
> Subject: Re: Concurrency Issue
> 
> 
>> Not sure about my previous theory anymore, it would throw an exception if
> it
>> had a problem reading a block of data, still investigating...
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: poi-dev-help@jakarta.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-dev-help@jakarta.apache.org
> 

-- 
Andrew C. Oliver
http://www.superlinksoftware.com/poi.jsp
Custom enhancements and Commercial Implementation for Jakarta POI

http://jakarta.apache.org/poi
For Java and Excel, Got POI?


Re: Concurrency Issue

Posted by Ryan Ackley <sa...@cfl.rr.com>.
doh! Found the problem, LittleEndian uses static byte arrays when it reads
from a stream.

Ryan

----- Original Message ----- 
From: "Ryan Ackley" <sa...@cfl.rr.com>
To: "POI Developers List" <po...@jakarta.apache.org>
Sent: Thursday, June 26, 2003 3:36 PM
Subject: Re: Concurrency Issue


> Not sure about my previous theory anymore, it would throw an exception if
it
> had a problem reading a block of data, still investigating...
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-dev-help@jakarta.apache.org
>


Re: Concurrency Issue

Posted by Ryan Ackley <sa...@cfl.rr.com>.
Not sure about my previous theory anymore, it would throw an exception if it
had a problem reading a block of data, still investigating...


Re: Concurrency Issue

Posted by "Andrew C. Oliver" <ac...@apache.org>.
This makes way more sense.

On 6/26/03 3:21 PM, "Ryan Ackley" <sa...@cfl.rr.com> wrote:

> It may be related to the issue that we don't handle low performance
> InputStreams in POIFS. If you have two processors only one of them can
> control the PCI bus at any one. So if one attempts to read from the hard
> drive it may not get anything until the other processor releases the PCI
> bus.
> 
> It is definitely I/O related because somehow the actual byte array that was
> read from the workbook is being corrupted. Also, it only happens about 50%
> of the time on my development machine. I have a scsi bus so that may explain
> why it works for me some of the time and it happens in several different
> places. I think a SCSI bus is more asynchronous than a pci bus.
> 
> Avik, I don't think it has anything to do with the memory model because I am
> running with dual xeon/Windows. The windows jdk uses the native threads
> which use virtual memory. I can't think of a way that it would allow this to
> happen.
> 
> Ryan
> 
> ----- Original Message -----
> From: "Avik Sengupta" <Av...@itellix.com>
> To: <po...@jakarta.apache.org>
> Cc: <Vi...@ubsw.com>
> Sent: Thursday, June 26, 2003 11:25 AM
> Subject: RE: Concurrency Issue
> 
> 
>> Summary for those who came in late: Reading different files using
>> different HSSFWorkbook objects in different threads works fine on a
>> single processor box, but doesnt work on a multi processor box.
>> 
>> I have the sinking feeling that we have hit some nice Java Memory Model
>> issue. While Java Memory Model does not guarantee that multithreaded
>> programs behave the same in single and multi-processor boxes, its
>> actually very rare to see these errors in practice (incorrect concurrent
>> access to a static variable, for example, will show up in a
>> multithreaded program even on a single processor box. ) So its something
>> much more subtle.
>> 
>> The error is however quite consistent. I have tested on a dual proc
>> Xeon/Linux and a dual Sparc/Solaris.
>> 
>> The only workaround for now is that only one thread at a time reads a
>> file into an HSSFWorkbook.
>> 
>> Am continuing to look at it..tho am not very hopeful for an immediate
>> fix.. its  a dog to debug!
>> 
>> On Fri, 2003-06-13 at 22:11, Avik Sengupta wrote:
>>> [moving to poi dev]
>>> I have now confirmed this issue. A simple program reading different xls
>>> files in different threads using different instances of PoifsFileSystem
>>> and HSSFWorkbook fails.
>>> 
>>> I am currently unable to say further why this is so, since a quick look
>>> at both POIFSFileSystem and HSSFWorkbook show no instances of static
>>> data. Will look into this further.
>>> 
>>> Regards
>>> -
>>> Avik
>>> 
>>> 
>>> On Wed, 2003-05-14 at 14:41, Avik Sengupta wrote:
>>>> I do not believe there are static stuff which precludes reading many
>>>> files at a go, but i could be wrong.
>>>> 
>>>> I would actually guess that one particular file of yours is throwing
> up
>>>> some pre-existing bug in poi. Have you checked that all the files you
>>>> want to open can be opened sequentially in poi?
>>>> 
>>>> On Tue, 2003-05-13 at 22:38, Vilay.Wadhwa@ubsw.com wrote:
>>>>> Hi Avik,
>>>>> 
>>>>> Thanks a lot for the response.
>>>>> I am creating diff. HSSFWorkBook for diff. uploaded files via diff.
> threads.
>>>>> But for some reason one of the WorkBook constructor fails.
>>>>> 
>>>>> Can you please let me know if we have any limit on reading the files
> concurrently
>>>>> or any other part of the code( static stuff ) that may be causing
> this issue.
>>>>> 
>>>>> By the way, can I have your contact # or do you prefer to have my
> contact # and
>>>>> we can have a quick chat.
>>>>> 
>>>>> Cheers
>>>>> Vilay
>>>>> 
>>>>> 
>>>>> -----Original Message-----
>>>>> From: Avik Sengupta [mailto:avik@apache.org]
>>>>> Sent: Tuesday, May 13, 2003 5:53 AM
>>>>> To: POI Users List
>>>>> Subject: Re: Concurrency Issue
>>>>> 
>>>>> 
>>>>> you cannot use a single HSSFWorkbook object from more than one
> thread.
>>>>> you will need to synchronise access to that object. Of course, you
> can
>>>>> use different HSSFWorkbook objects in different threads
> concurrently.
>>>>> 
>>>>> 
>>>>> 
>>>>> On Tue, 2003-05-13 at 02:00, Vilay.Wadhwa@ubsw.com wrote:
>>>>>> Hi Guys,
>>>>>> 
>>>>>> I am having problem reading more than one file Excel files
> concurrently.
>>>>>> Reading individual files seem to be fine.
>>>>>> 
>>>>>> The exception I get is as follows:
>>>>>> 
>>>>>> java.lang.reflect.InvocationTargetException:
> java.lang.ArrayIndexOutOfBoundsException
>>>>>> at
> org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java:557)
>>>>>> at org.apache.poi.util.LittleEndian.getInt(LittleEndian.java:177)
>>>>>> at
> org.apache.poi.hssf.record.DimensionsRecord.fillFields(DimensionsRecord.java
> :121)
>>>>>> at org.apache.poi.hssf.record.Record.fillFields(Record.java:143)
>>>>>> at org.apache.poi.hssf.record.Record.<init>(Record.java:105)
>>>>>> at
> org.apache.poi.hssf.record.DimensionsRecord.<init>(DimensionsRecord.java:94)
>>>>>> at java.lang.reflect.Constructor.newInstance(Native Method)
>>>>>> at
> org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:254
> )
>>>>>> at
> org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:19
> 2)
>>>>>> at
> org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:191)
>>>>>> at
> org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:158)
>>>>>> 
>>>>>> 
>>>>>> 
>>>>>> Your help is highly appreciated.
>>>>>> 
>>>>>> Best Regards,
>>>>>> Vilay
>>>>>> 
>>>>>> Visit our website at http://www.ubswarburg.com
>>>>>> 
>>>>>> This message contains confidential information and is intended
> only
>>>>>> for the individual named.  If you are not the named addressee you
>>>>>> should not disseminate, distribute or copy this e-mail.  Please
>>>>>> notify the sender immediately by e-mail if you have received this
>>>>>> e-mail by mistake and delete this e-mail from your system.
>>>>>> 
>>>>>> E-mail transmission cannot be guaranteed to be secure or
> error-free
>>>>>> as information could be intercepted, corrupted, lost, destroyed,
>>>>>> arrive late or incomplete, or contain viruses.  The sender
> therefore
>>>>>> does not accept liability for any errors or omissions in the
> contents
>>>>>> of this message which arise as a result of e-mail transmission.
> If
>>>>>> verification is required please request a hard-copy version.  This
>>>>>> message is provided for informational purposes and should not be
>>>>>> construed as a solicitation or offer to buy or sell any securities
> or
>>>>>> related financial instruments.
>>>>>> 
>>>>>> 
>>>>> 
>> ---------------------------------------------------------------------
>>>>>> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>>>>>> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>>> 
>>>> 
>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>>>>> 
>>>>> 
>>>>> Visit our website at http://www.ubswarburg.com
>>>>> 
>>>>> This message contains confidential information and is intended only
>>>>> for the individual named.  If you are not the named addressee you
>>>>> should not disseminate, distribute or copy this e-mail.  Please
>>>>> notify the sender immediately by e-mail if you have received this
>>>>> e-mail by mistake and delete this e-mail from your system.
>>>>> 
>>>>> E-mail transmission cannot be guaranteed to be secure or error-free
>>>>> as information could be intercepted, corrupted, lost, destroyed,
>>>>> arrive late or incomplete, or contain viruses.  The sender therefore
>>>>> does not accept liability for any errors or omissions in the
> contents
>>>>> of this message which arise as a result of e-mail transmission.  If
>>>>> verification is required please request a hard-copy version.  This
>>>>> message is provided for informational purposes and should not be
>>>>> construed as a solicitation or offer to buy or sell any securities
> or
>>>>> related financial instruments.
>>>>> 
>>>>> 
>>>> 
>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>>>>> 
>>>> 
>> 
>> 
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
>> For additional commands, e-mail: poi-dev-help@jakarta.apache.org
>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-dev-help@jakarta.apache.org
> 

-- 
Andrew C. Oliver
http://www.superlinksoftware.com/poi.jsp
Custom enhancements and Commercial Implementation for Jakarta POI

http://jakarta.apache.org/poi
For Java and Excel, Got POI?


Re: Concurrency Issue

Posted by Ryan Ackley <sa...@cfl.rr.com>.
It may be related to the issue that we don't handle low performance
InputStreams in POIFS. If you have two processors only one of them can
control the PCI bus at any one. So if one attempts to read from the hard
drive it may not get anything until the other processor releases the PCI
bus.

It is definitely I/O related because somehow the actual byte array that was
read from the workbook is being corrupted. Also, it only happens about 50%
of the time on my development machine. I have a scsi bus so that may explain
why it works for me some of the time and it happens in several different
places. I think a SCSI bus is more asynchronous than a pci bus.

Avik, I don't think it has anything to do with the memory model because I am
running with dual xeon/Windows. The windows jdk uses the native threads
which use virtual memory. I can't think of a way that it would allow this to
happen.

Ryan

----- Original Message ----- 
From: "Avik Sengupta" <Av...@itellix.com>
To: <po...@jakarta.apache.org>
Cc: <Vi...@ubsw.com>
Sent: Thursday, June 26, 2003 11:25 AM
Subject: RE: Concurrency Issue


> Summary for those who came in late: Reading different files using
> different HSSFWorkbook objects in different threads works fine on a
> single processor box, but doesnt work on a multi processor box.
>
> I have the sinking feeling that we have hit some nice Java Memory Model
> issue. While Java Memory Model does not guarantee that multithreaded
> programs behave the same in single and multi-processor boxes, its
> actually very rare to see these errors in practice (incorrect concurrent
> access to a static variable, for example, will show up in a
> multithreaded program even on a single processor box. ) So its something
> much more subtle.
>
> The error is however quite consistent. I have tested on a dual proc
> Xeon/Linux and a dual Sparc/Solaris.
>
> The only workaround for now is that only one thread at a time reads a
> file into an HSSFWorkbook.
>
> Am continuing to look at it..tho am not very hopeful for an immediate
> fix.. its  a dog to debug!
>
> On Fri, 2003-06-13 at 22:11, Avik Sengupta wrote:
> > [moving to poi dev]
> > I have now confirmed this issue. A simple program reading different xls
> > files in different threads using different instances of PoifsFileSystem
> > and HSSFWorkbook fails.
> >
> > I am currently unable to say further why this is so, since a quick look
> > at both POIFSFileSystem and HSSFWorkbook show no instances of static
> > data. Will look into this further.
> >
> > Regards
> > -
> > Avik
> >
> >
> > On Wed, 2003-05-14 at 14:41, Avik Sengupta wrote:
> > > I do not believe there are static stuff which precludes reading many
> > > files at a go, but i could be wrong.
> > >
> > > I would actually guess that one particular file of yours is throwing
up
> > > some pre-existing bug in poi. Have you checked that all the files you
> > > want to open can be opened sequentially in poi?
> > >
> > > On Tue, 2003-05-13 at 22:38, Vilay.Wadhwa@ubsw.com wrote:
> > > > Hi Avik,
> > > >
> > > > Thanks a lot for the response.
> > > > I am creating diff. HSSFWorkBook for diff. uploaded files via diff.
threads.
> > > > But for some reason one of the WorkBook constructor fails.
> > > >
> > > > Can you please let me know if we have any limit on reading the files
concurrently
> > > > or any other part of the code( static stuff ) that may be causing
this issue.
> > > >
> > > > By the way, can I have your contact # or do you prefer to have my
contact # and
> > > > we can have a quick chat.
> > > >
> > > > Cheers
> > > > Vilay
> > > >
> > > >
> > > > -----Original Message-----
> > > > From: Avik Sengupta [mailto:avik@apache.org]
> > > > Sent: Tuesday, May 13, 2003 5:53 AM
> > > > To: POI Users List
> > > > Subject: Re: Concurrency Issue
> > > >
> > > >
> > > > you cannot use a single HSSFWorkbook object from more than one
thread.
> > > > you will need to synchronise access to that object. Of course, you
can
> > > > use different HSSFWorkbook objects in different threads
concurrently.
> > > >
> > > >
> > > >
> > > > On Tue, 2003-05-13 at 02:00, Vilay.Wadhwa@ubsw.com wrote:
> > > > > Hi Guys,
> > > > >
> > > > > I am having problem reading more than one file Excel files
concurrently.
> > > > > Reading individual files seem to be fine.
> > > > >
> > > > > The exception I get is as follows:
> > > > >
> > > > > java.lang.reflect.InvocationTargetException:
java.lang.ArrayIndexOutOfBoundsException
> > > > > at
org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java:557)
> > > > > at org.apache.poi.util.LittleEndian.getInt(LittleEndian.java:177)
> > > > > at
org.apache.poi.hssf.record.DimensionsRecord.fillFields(DimensionsRecord.java
:121)
> > > > > at org.apache.poi.hssf.record.Record.fillFields(Record.java:143)
> > > > > at org.apache.poi.hssf.record.Record.<init>(Record.java:105)
> > > > > at
org.apache.poi.hssf.record.DimensionsRecord.<init>(DimensionsRecord.java:94)
> > > > > at java.lang.reflect.Constructor.newInstance(Native Method)
> > > > > at
org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:254
)
> > > > > at
org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:19
2)
> > > > > at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:191)
> > > > > at
org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:158)
> > > > >
> > > > >
> > > > >
> > > > > Your help is highly appreciated.
> > > > >
> > > > > Best Regards,
> > > > > Vilay
> > > > >
> > > > > Visit our website at http://www.ubswarburg.com
> > > > >
> > > > > This message contains confidential information and is intended
only
> > > > > for the individual named.  If you are not the named addressee you
> > > > > should not disseminate, distribute or copy this e-mail.  Please
> > > > > notify the sender immediately by e-mail if you have received this
> > > > > e-mail by mistake and delete this e-mail from your system.
> > > > >
> > > > > E-mail transmission cannot be guaranteed to be secure or
error-free
> > > > > as information could be intercepted, corrupted, lost, destroyed,
> > > > > arrive late or incomplete, or contain viruses.  The sender
therefore
> > > > > does not accept liability for any errors or omissions in the
contents
> > > > > of this message which arise as a result of e-mail transmission.
If
> > > > > verification is required please request a hard-copy version.  This
> > > > > message is provided for informational purposes and should not be
> > > > > construed as a solicitation or offer to buy or sell any securities
or
> > > > > related financial instruments.
> > > > >
> > > > >
> > > >
> ---------------------------------------------------------------------
> > > > > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > > > > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> > > > >
> > > >
> > > >
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> > > >
> > > >
> > > > Visit our website at http://www.ubswarburg.com
> > > >
> > > > This message contains confidential information and is intended only
> > > > for the individual named.  If you are not the named addressee you
> > > > should not disseminate, distribute or copy this e-mail.  Please
> > > > notify the sender immediately by e-mail if you have received this
> > > > e-mail by mistake and delete this e-mail from your system.
> > > >
> > > > E-mail transmission cannot be guaranteed to be secure or error-free
> > > > as information could be intercepted, corrupted, lost, destroyed,
> > > > arrive late or incomplete, or contain viruses.  The sender therefore
> > > > does not accept liability for any errors or omissions in the
contents
> > > > of this message which arise as a result of e-mail transmission.  If
> > > > verification is required please request a hard-copy version.  This
> > > > message is provided for informational purposes and should not be
> > > > construed as a solicitation or offer to buy or sell any securities
or
> > > > related financial instruments.
> > > >
> > > >
> > >
> ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> > > >
> > >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-dev-help@jakarta.apache.org
>


Re: Concurrency Issue

Posted by "Andrew C. Oliver" <ac...@apache.org>.
Man, that¹s a bugger.  What VM's have you tested?  Does this happen on IBM's
VM for instance?

I need a damn mp box for testing....  Only trouble is that I have expensive
tastes:
http://store.apple.com/1-800-MY-APPLE/WebObjects/AppleStore?family=PowerMac

;-)

-Andy  

On 6/26/03 11:25 AM, "Avik Sengupta" <Av...@itellix.com> wrote:

> Summary for those who came in late: Reading different files using
> different HSSFWorkbook objects in different threads works fine on a
> single processor box, but doesnt work on a multi processor box.
> 
> I have the sinking feeling that we have hit some nice Java Memory Model
> issue. While Java Memory Model does not guarantee that multithreaded
> programs behave the same in single and multi-processor boxes, its
> actually very rare to see these errors in practice (incorrect concurrent
> access to a static variable, for example, will show up in a
> multithreaded program even on a single processor box. ) So its something
> much more subtle.
> 
> The error is however quite consistent. I have tested on a dual proc
> Xeon/Linux and a dual Sparc/Solaris.
> 
> The only workaround for now is that only one thread at a time reads a
> file into an HSSFWorkbook.
> 
> Am continuing to look at it..tho am not very hopeful for an immediate
> fix.. its  a dog to debug!
> 
> On Fri, 2003-06-13 at 22:11, Avik Sengupta wrote:
>> [moving to poi dev]
>> I have now confirmed this issue. A simple program reading different xls
>> files in different threads using different instances of PoifsFileSystem
>> and HSSFWorkbook fails.
>> 
>> I am currently unable to say further why this is so, since a quick look
>> at both POIFSFileSystem and HSSFWorkbook show no instances of static
>> data. Will look into this further.
>> 
>> Regards
>> -
>> Avik
>> 
>> 
>> On Wed, 2003-05-14 at 14:41, Avik Sengupta wrote:
>>> I do not believe there are static stuff which precludes reading many
>>> files at a go, but i could be wrong.
>>> 
>>> I would actually guess that one particular file of yours is throwing up
>>> some pre-existing bug in poi. Have you checked that all the files you
>>> want to open can be opened sequentially in poi?
>>> 
>>> On Tue, 2003-05-13 at 22:38, Vilay.Wadhwa@ubsw.com wrote:
>>>> Hi Avik,
>>>> 
>>>> Thanks a lot for the response.
>>>> I am creating diff. HSSFWorkBook for diff. uploaded files via diff.
>>>> threads.
>>>> But for some reason one of the WorkBook constructor fails.
>>>> 
>>>> Can you please let me know if we have any limit on reading the files
>>>> concurrently
>>>> or any other part of the code( static stuff ) that may be causing this
>>>> issue.
>>>> 
>>>> By the way, can I have your contact # or do you prefer to have my contact #
>>>> and 
>>>> we can have a quick chat.
>>>> 
>>>> Cheers
>>>> Vilay
>>>> 
>>>> 
>>>> -----Original Message-----
>>>> From: Avik Sengupta [mailto:avik@apache.org]
>>>> Sent: Tuesday, May 13, 2003 5:53 AM
>>>> To: POI Users List
>>>> Subject: Re: Concurrency Issue
>>>> 
>>>> 
>>>> you cannot use a single HSSFWorkbook object from more than one thread.
>>>> you will need to synchronise access to that object. Of course, you can
>>>> use different HSSFWorkbook objects in different threads concurrently.
>>>> 
>>>> 
>>>> 
>>>> On Tue, 2003-05-13 at 02:00, Vilay.Wadhwa@ubsw.com wrote:
>>>>> Hi Guys,
>>>>> 
>>>>> I am having problem reading more than one file Excel files concurrently.
>>>>> Reading individual files seem to be fine.
>>>>> 
>>>>> The exception I get is as follows:
>>>>> 
>>>>> java.lang.reflect.InvocationTargetException:
>>>>> java.lang.ArrayIndexOutOfBoundsException
>>>>> at org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java:557)
>>>>> at org.apache.poi.util.LittleEndian.getInt(LittleEndian.java:177)
>>>>> at 
>>>>> org.apache.poi.hssf.record.DimensionsRecord.fillFields(DimensionsRecord.ja
>>>>> va:121)
>>>>> at org.apache.poi.hssf.record.Record.fillFields(Record.java:143)
>>>>> at org.apache.poi.hssf.record.Record.<init>(Record.java:105)
>>>>> at 
>>>>> org.apache.poi.hssf.record.DimensionsRecord.<init>(DimensionsRecord.java:9
>>>>> 4)
>>>>> at java.lang.reflect.Constructor.newInstance(Native Method)
>>>>> at 
>>>>> org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:2
>>>>> 54)
>>>>> at 
>>>>> org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:
>>>>> 192)
>>>>> at 
>>>>> org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:191)
>>>>> at 
>>>>> org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:158)
>>>>> 
>>>>> 
>>>>> 
>>>>> Your help is highly appreciated.
>>>>> 
>>>>> Best Regards,
>>>>> Vilay
>>>>> 
>>>>> Visit our website at http://www.ubswarburg.com
>>>>> 
>>>>> This message contains confidential information and is intended only
>>>>> for the individual named.  If you are not the named addressee you
>>>>> should not disseminate, distribute or copy this e-mail.  Please
>>>>> notify the sender immediately by e-mail if you have received this
>>>>> e-mail by mistake and delete this e-mail from your system.
>>>>> 
>>>>> E-mail transmission cannot be guaranteed to be secure or error-free
>>>>> as information could be intercepted, corrupted, lost, destroyed,
>>>>> arrive late or incomplete, or contain viruses.  The sender therefore
>>>>> does not accept liability for any errors or omissions in the contents
>>>>> of this message which arise as a result of e-mail transmission.  If
>>>>> verification is required please request a hard-copy version.  This
>>>>> message is provided for informational purposes and should not be
>>>>> construed as a solicitation or offer to buy or sell any securities or
>>>>> related financial instruments.
>>>>> 
>>>>> 
>>>>> ---------------------------------------------------------------------
>>>>> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>>>>> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>>>>> 
>>>> 
>>>> 
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>>>> 
>>>> 
>>>> Visit our website at http://www.ubswarburg.com
>>>> 
>>>> This message contains confidential information and is intended only
>>>> for the individual named.  If you are not the named addressee you
>>>> should not disseminate, distribute or copy this e-mail.  Please
>>>> notify the sender immediately by e-mail if you have received this
>>>> e-mail by mistake and delete this e-mail from your system.
>>>> 
>>>> E-mail transmission cannot be guaranteed to be secure or error-free
>>>> as information could be intercepted, corrupted, lost, destroyed,
>>>> arrive late or incomplete, or contain viruses.  The sender therefore
>>>> does not accept liability for any errors or omissions in the contents
>>>> of this message which arise as a result of e-mail transmission.  If
>>>> verification is required please request a hard-copy version.  This
>>>> message is provided for informational purposes and should not be
>>>> construed as a solicitation or offer to buy or sell any securities or
>>>> related financial instruments.
>>>> 
>>>> 
>>>> ---------------------------------------------------------------------
>>>> To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
>>>> For additional commands, e-mail: poi-user-help@jakarta.apache.org
>>>> 
>>> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: poi-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: poi-dev-help@jakarta.apache.org
> 

-- 
Andrew C. Oliver
http://www.superlinksoftware.com/poi.jsp
Custom enhancements and Commercial Implementation for Jakarta POI

http://jakarta.apache.org/poi
For Java and Excel, Got POI?


RE: Concurrency Issue

Posted by Avik Sengupta <Av...@itellix.com>.
Summary for those who came in late: Reading different files using
different HSSFWorkbook objects in different threads works fine on a
single processor box, but doesnt work on a multi processor box. 

I have the sinking feeling that we have hit some nice Java Memory Model
issue. While Java Memory Model does not guarantee that multithreaded
programs behave the same in single and multi-processor boxes, its
actually very rare to see these errors in practice (incorrect concurrent
access to a static variable, for example, will show up in a
multithreaded program even on a single processor box. ) So its something
much more subtle. 

The error is however quite consistent. I have tested on a dual proc
Xeon/Linux and a dual Sparc/Solaris. 

The only workaround for now is that only one thread at a time reads a
file into an HSSFWorkbook. 

Am continuing to look at it..tho am not very hopeful for an immediate
fix.. its  a dog to debug! 

On Fri, 2003-06-13 at 22:11, Avik Sengupta wrote:
> [moving to poi dev]
> I have now confirmed this issue. A simple program reading different xls
> files in different threads using different instances of PoifsFileSystem
> and HSSFWorkbook fails. 
> 
> I am currently unable to say further why this is so, since a quick look
> at both POIFSFileSystem and HSSFWorkbook show no instances of static
> data. Will look into this further. 
> 
> Regards
> -
> Avik
> 
> 
> On Wed, 2003-05-14 at 14:41, Avik Sengupta wrote:
> > I do not believe there are static stuff which precludes reading many
> > files at a go, but i could be wrong. 
> > 
> > I would actually guess that one particular file of yours is throwing up
> > some pre-existing bug in poi. Have you checked that all the files you
> > want to open can be opened sequentially in poi?
> > 
> > On Tue, 2003-05-13 at 22:38, Vilay.Wadhwa@ubsw.com wrote:
> > > Hi Avik,
> > > 
> > > Thanks a lot for the response.
> > > I am creating diff. HSSFWorkBook for diff. uploaded files via diff. threads.
> > > But for some reason one of the WorkBook constructor fails.
> > > 
> > > Can you please let me know if we have any limit on reading the files concurrently
> > > or any other part of the code( static stuff ) that may be causing this issue.
> > > 
> > > By the way, can I have your contact # or do you prefer to have my contact # and 
> > > we can have a quick chat.
> > > 
> > > Cheers
> > > Vilay
> > > 
> > > 
> > > -----Original Message-----
> > > From: Avik Sengupta [mailto:avik@apache.org]
> > > Sent: Tuesday, May 13, 2003 5:53 AM
> > > To: POI Users List
> > > Subject: Re: Concurrency Issue
> > > 
> > > 
> > > you cannot use a single HSSFWorkbook object from more than one thread.
> > > you will need to synchronise access to that object. Of course, you can
> > > use different HSSFWorkbook objects in different threads concurrently. 
> > > 
> > > 
> > > 
> > > On Tue, 2003-05-13 at 02:00, Vilay.Wadhwa@ubsw.com wrote:
> > > > Hi Guys,
> > > > 
> > > > I am having problem reading more than one file Excel files concurrently.
> > > > Reading individual files seem to be fine.
> > > > 
> > > > The exception I get is as follows:
> > > > 
> > > > java.lang.reflect.InvocationTargetException: java.lang.ArrayIndexOutOfBoundsException
> > > > 	at org.apache.poi.util.LittleEndian.getNumber(LittleEndian.java:557)
> > > > 	at org.apache.poi.util.LittleEndian.getInt(LittleEndian.java:177)
> > > > 	at org.apache.poi.hssf.record.DimensionsRecord.fillFields(DimensionsRecord.java:121)
> > > > 	at org.apache.poi.hssf.record.Record.fillFields(Record.java:143)
> > > > 	at org.apache.poi.hssf.record.Record.<init>(Record.java:105)
> > > > 	at org.apache.poi.hssf.record.DimensionsRecord.<init>(DimensionsRecord.java:94)
> > > > 	at java.lang.reflect.Constructor.newInstance(Native Method)
> > > > 	at org.apache.poi.hssf.record.RecordFactory.createRecord(RecordFactory.java:254)
> > > > 	at org.apache.poi.hssf.record.RecordFactory.createRecords(RecordFactory.java:192)
> > > > 	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:191)
> > > > 	at org.apache.poi.hssf.usermodel.HSSFWorkbook.<init>(HSSFWorkbook.java:158)
> > > > 	
> > > > 
> > > > 
> > > > Your help is highly appreciated.
> > > > 
> > > > Best Regards,
> > > > Vilay
> > > > 
> > > > Visit our website at http://www.ubswarburg.com
> > > > 
> > > > This message contains confidential information and is intended only 
> > > > for the individual named.  If you are not the named addressee you 
> > > > should not disseminate, distribute or copy this e-mail.  Please 
> > > > notify the sender immediately by e-mail if you have received this 
> > > > e-mail by mistake and delete this e-mail from your system.
> > > > 
> > > > E-mail transmission cannot be guaranteed to be secure or error-free 
> > > > as information could be intercepted, corrupted, lost, destroyed, 
> > > > arrive late or incomplete, or contain viruses.  The sender therefore 
> > > > does not accept liability for any errors or omissions in the contents 
> > > > of this message which arise as a result of e-mail transmission.  If 
> > > > verification is required please request a hard-copy version.  This 
> > > > message is provided for informational purposes and should not be 
> > > > construed as a solicitation or offer to buy or sell any securities or 
> > > > related financial instruments.
> > > > 
> > > > 
> > > > ---------------------------------------------------------------------
> > > > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > > > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> > > > 
> > > 
> > > 
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> > > 
> > > 
> > > Visit our website at http://www.ubswarburg.com
> > > 
> > > This message contains confidential information and is intended only 
> > > for the individual named.  If you are not the named addressee you 
> > > should not disseminate, distribute or copy this e-mail.  Please 
> > > notify the sender immediately by e-mail if you have received this 
> > > e-mail by mistake and delete this e-mail from your system.
> > > 
> > > E-mail transmission cannot be guaranteed to be secure or error-free 
> > > as information could be intercepted, corrupted, lost, destroyed, 
> > > arrive late or incomplete, or contain viruses.  The sender therefore 
> > > does not accept liability for any errors or omissions in the contents 
> > > of this message which arise as a result of e-mail transmission.  If 
> > > verification is required please request a hard-copy version.  This 
> > > message is provided for informational purposes and should not be 
> > > construed as a solicitation or offer to buy or sell any securities or 
> > > related financial instruments.
> > > 
> > > 
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: poi-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: poi-user-help@jakarta.apache.org
> > > 
> >