Re: [h2] ArrayIndexOutOfBoundsException with multiple Threads using h2-1.3.176

2016-07-27 Thread Nick99
I have seen this on 1.3.175 in the customer's logs. Config: 
MVCC=TRUE;MULTI_THREADED=0;LOCK_MODE=3;LOCK_TIMEOUT=2;

Here's a stacktrace:

2016-07-25T17:09:43,158 [ERROR][System.err] Caused by: 
org.h2.jdbc.JdbcSQLException: IO Exception: "java.io.IOException: 
java.lang.ArrayIndexOutOfBoundsException: 0"; "lob: null table: -1 id: 
9100" [90031-175]
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.h2.message.DbException.getJdbcSQLException(DbException.java:332)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.h2.message.DbException.get(DbException.java:161)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.h2.message.DbException.convertIOException(DbException.java:318)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.h2.value.ValueLobDb.getBytesNoCopy(ValueLobDb.java:340)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.h2.value.ValueLobDb.getBytes(ValueLobDb.java:324)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.h2.jdbc.JdbcResultSet.getBytes(JdbcResultSet.java:1042)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
com.mchange.v2.c3p0.impl.NewProxyResultSet.getBytes(NewProxyResultSet.java:659)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.hibernate.type.descriptor.sql.VarbinaryTypeDescriptor$2.doExtract(VarbinaryTypeDescriptor.java:70)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:267)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:263)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:253)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:338)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2969)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.hibernate.loader.plan.exec.process.internal.EntityReferenceInitializerImpl.loadFromResultSet(EntityReferenceInitializerImpl.java:324)
2016-07-25T17:09:43,158 [ERROR][System.err] ... 111 more
2016-07-25T17:09:43,158 [ERROR][System.err] Caused by: java.io.IOException: 
java.lang.ArrayIndexOutOfBoundsException: 0
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.h2.message.DbException.convertToIOException(DbException.java:351)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.h2.util.IOUtils.copy(IOUtils.java:177)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.h2.util.IOUtils.readBytesAndClose(IOUtils.java:277)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.h2.value.ValueLobDb.getBytesNoCopy(ValueLobDb.java:338)
2016-07-25T17:09:43,158 [ERROR][System.err] ... 122 more
2016-07-25T17:09:43,158 [ERROR][System.err] Caused by: 
java.lang.ArrayIndexOutOfBoundsException: 0
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.h2.store.LobStorageBackend$LobInputStream.fillBuffer(LobStorageBackend.java:777)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.h2.store.LobStorageBackend$LobInputStream.readFully(LobStorageBackend.java:753)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.h2.store.LobStorageBackend$LobInputStream.read(LobStorageBackend.java:744)
2016-07-25T17:09:43,158 [ERROR][System.err] at 
org.h2.util.IOUtils.copy(IOUtils.java:164)



On Friday, July 11, 2014 at 3:31:09 PM UTC+3, Thomas Mueller Graf wrote:
>
> Hi,
>
> I can reproduce the problem with version 1.3.x, or with version 1.4.x when 
> disabling the MVStore (append ";mv_store=false" to the database URL). With 
> version 1.4.x (beta), that is with the MVStore, it does not occur.
>
> I'm not quite sure what the problem is, it looks like the LOB is removed a 
> bit too early. What is easy to change is the error message (it should say 
> "Missing lob entry"), but I'm not sure how to best fix the problem.
>
> Regards,
> Thomas
>
>
>
>
>
> On Wed, Jul 9, 2014 at 9:40 PM, Torben Schinke  > wrote:
>
>> I get an unexpected IndexOutOfBounds-Exception in the LobStorageBackend 
>> when reading blobs from a table which gets concurrently updated from 
>> another thread (however the update is not performed on the blob-field).
>>
>> I attached a simple test case for that and I'm able to reproduce that 
>> quite reliable on MacOS and Android. Pastebin: 
>> http://pastebin.com/3N99rZNp
>>
>> The stack trace is:
>>
>> Exception in thread "main" java.util.concurrent.ExecutionException: 
>> org.h2.jdbc.JdbcSQLException: Eingabe/Ausgabe: "java.io.IOException: 
>> java.lang.ArrayIndexOutOfBoundsException: 0"; "lob: null table: -1 id: 
>> 1950"
>> IO Exception: "java.io.IOException: 
>> java.lang.ArrayIndexOutOfBoundsException: 0"; "lob: null table: -1 id: 
>> 1950" [90031-176]
>> at java.util.concurrent.FutureTask$Sync.

Re: [h2] Unique index or primary key violation: "SYS_ID ON PUBLIC.SYS(ID)" [23505-168] (using 1.3.168)

2014-05-28 Thread Nick99
Same problem.

1.
The database was created in CREATE_BUILD 170, then was used with 1.3.174. 
I've tried using 1.4.178 on that database in Hibernate-based product - got 

org.h2.jdbc.JdbcSQLException: Unique index or primary key violation: 
"PRIMARY KEY ON .PAGE_INDEX"; SQL statement:[...]

1.3.175 works ok on that db. 1.3.176 is not.

2.
Opening the db in 1.3.176 Console produces this (table names removed):

Unique index or primary key violation: "PRIMARY KEY ON .PAGE_INDEX"; 
SQL statement:
ALTER TABLE PUBLIC.-- ADD CONSTRAINT PUBLIC.FK28D9808AF98221CA 
FOREIGN KEY(JESID) REFERENCES PUBLIC.--(ID) NOCHECK [23505-176] 
23505/23505 (Help)


On Monday, May 26, 2014 10:33:05 AM UTC+3, Germano Rizzo wrote:
>
> Provided 
> here. 
> Thanks!
>
> Il giorno giovedì 22 maggio 2014 17:43:18 UTC+2, Thomas Mueller ha scritto:
>>
>> Hi
>>
>> I would need a reproducible test case, or the database file. 
>>
>> Regards, Thomas 
>>
>> On Thursday, May 22, 2014, jack jin  wrote:
>>
>>> when I upgrade to 1.3.176,I have the same problem.  the old version h2 
>>> is works fine with the db file
>>>
>>> On Tuesday, May 6, 2014 5:00:52 PM UTC+8, Germano Rizzo wrote:

 Hi Thomas,
 so your opinion is that all the db's are corrupted? The strange 
 thing is, they fail to open only with the latest stable version. Every 
 other version I tried works fine, and this configuration have worked in 40 
 installations for 3 years now, across different versions of H2. Do you 
 want 
 me to start another thread?

  Germano

 Il giorno martedì 6 maggio 2014 07:59:45 UTC+2, Thomas Mueller ha 
 scritto:
>
> Hi,
>
> If you are using LOCK_MODE=0;UNDO_LOG=0 then you need to be aware of 
> the risks. See the FAQ and the documentation.
>
> Please use different email subjects for different problems.
>
> Regards,
> Thomas
>
>
> On Monday, May 5, 2014, mano  wrote:
>
>> mano wrote
>> > Opening it with version 1.3.168 will give the error.
>>
>> Sorry, I meant 1.3.176.
>>
>>
>>
>>
>> --
>> View this message in context: http://h2-database.66688.n3.
>> nabble.com/Unique-index-or-primary-key-violation-SYS-ID-
>> ON-PUBLIC-SYS-ID-23505-168-using-1-3-168-tp4028700p4029078.html
>> Sent from the H2 Database mailing list archive at Nabble.com.
>>
>> --
>> You received this message because you are subscribed to the Google 
>> Groups "H2 Database" group.
>> To unsubscribe from this group and stop receiving emails from it, 
>> send an email to h2-database+unsubscr...@googlegroups.com.
>> To post to this group, send email to h2-database@googlegroups.com.
>> Visit this group at http://groups.google.com/group/h2-database.
>> For more options, visit https://groups.google.com/d/optout.
>>
>   -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "H2 Database" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to h2-database+unsubscr...@googlegroups.com.
>>> To post to this group, send email to h2-database@googlegroups.com.
>>> Visit this group at http://groups.google.com/group/h2-database.
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/d/optout.


[h2] Re: Concurrent operations on LOBs

2013-07-18 Thread Nick99
I can say that the approach with VARCHARs works ok in my case after several 
months of test/production usage. I'm using up to 10K length VARCHARs.

On Tuesday, March 5, 2013 2:18:21 AM UTC+2, Kartweel wrote:
>
> It depends on your use case I think. I recently had 10MB objects reading 
> into memory... but it wasn't very optimal and I did get OOM errors :). 
> I'm sure 1024 characters would be fine ;). It's probably faster than 
> with CLOBS as they'll be inline so one less pointer to follow. 
>
> I'd just test it and see how you go. I think CLOB will behave the same 
> as BLOB. But I guess you have to try it to make sure. 
>
> > > Integer.MAXVALUE 
> > I'll try to use VARCHAR(1024); but 
> > 
> > >  CLOB 
> > > should be used for documents and texts with arbitrary size such as XML 
> > > or HTML documents, text files, or memo fields of unlimited size. 
> > > VARCHAR should be used for text with relatively short average size 
> > > (for example shorter than 200 characters) 
> > 
>
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Concurrent operations on LOBs

2013-03-04 Thread Nick99
They are basically 1024 unicode chars tops. So keeping them in memory 
should be ok.

> Integer.MAXVALUE 
I'll try to use VARCHAR(1024); but

>  CLOB
> should be used for documents and texts with arbitrary size such as XML
> or HTML documents, text files, or memo fields of unlimited size.
> VARCHAR should be used for text with relatively short average size
> (for example shorter than 200 characters) 

On Friday, March 1, 2013 3:02:21 AM UTC+2, Kartweel wrote:
>
>  Side note: LOCK_MODE has no effect with MVCC.
>
> There is also a FOR UPDATE bug with LOBS in MVCC. My guess is these issues 
> won't get fixed unless you submit a patch as the devs are working on a new 
> storage backend which should solve all the issues.
>
> You could try BINARY? I think it stores the object in memory when you 
> query them? SO make sure you got enough memory to hold all your big 
> objects. Integer.MAXVALUE is 2GB of data if I'm not mistaken?. How big are 
> your BLOBS?
>
>
>
> On 1/03/2013 8:30 AM, Nick99 wrote:
>  
> Hello,
>
>  Any plans for the fix/workaround?  
>
>  I can only think of some pretty messy workarounds like moving my CLOB 
> fields to 
> a) just VARCHAR(*255*) /though the docs say *The maximum precision is 
> Integer.MAX_VALUE<http://www.h2database.com/html/datatypes.html#varchar_type>
> */ 
> b) or to BLOB (may behave the same way as CLOB) 
> c) or to BINARY (looks promising). 
>
>  
>
> On Tuesday, December 4, 2012 6:59:08 PM UTC+2, Nick99 wrote: 
>>
>> It seems the problem is with MVCC.
>>
>>  The test is not failing for 30s on my system 
>> with: "jdbc:h2:db/test01;MVCC=*FALSE*
>> ;MULTI_THREADED=0;LOCK_MODE=3;LOCK_TIMEOUT=2;"
>>  
>>  All isolation levels fail for (in the 1-5s 
>> timeframe): "jdbc:h2:db/test01;MVCC=*TRUE;*
>> MULTI_THREADED=0;LOCK_MODE=3;LOCK_TIMEOUT=2;" 
>> Connection.TRANSACTION_READ_UNCOMMITTED
>>  Connection.TRANSACTION_READ_COMMITTED
>>  Connection.TRANSACTION_REPEATABLE_READ
>>  Connection.TRANSACTION_SERIALIZABLE
>>
>> On Tuesday, December 4, 2012 11:01:37 AM U 
>> TC+2, Noel Grandin wrote: 
>>>
>>> Hmmm, I think what is happening here is that when in MVCC mode with 
>>> transaction isolation level TRANSACTION_READ_COMMITTED, the session is 
>>> somehow seeing LOB entries that have already been deleted. 
>>>
>>> Thomas, does that ring any bells? 
>>>
>>> I've been through the code paths that end up in LobStorage, but I can't 
>>> see any obvious problems. 
>>>
>>> On 2012-12-03 09:58, Noel Grandin wrote: 
>>> > Nice work on creating the test case! 
>>> > 
>>> > Interesting, this is a genuine bug somewhere in the LOB code, and it 
>>> > manifests even with MVCC=false. 
>>> > 
>>> > The only short-term fix I can see is to set your transaction isolation 
>>> > to  TRANSACTION_REPEATABLE_READ. 
>>> > 
>>> > Thomas, I further reduced the test-case, and I'm including it here. 
>>> > Note that (for me) it did not fail every single time. I normally let 
>>> > it run for about 15 seconds, and then terminate and try again. 
>>> > I get a failure rate of about 50%. 
>>> > 
>>>
>>>-- 
> You received this message because you are subscribed to the Google Groups 
> "H2 Database" group.
> To unsubscribe from this group and stop receiving emails from it, send an 
> email to h2-database...@googlegroups.com .
> To post to this group, send email to h2-da...@googlegroups.com
> .
> Visit this group at http://groups.google.com/group/h2-database?hl=en.
> For more options, visit https://groups.google.com/groups/opt_out.
>  
>  
>
>
>  

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Concurrent operations on LOBs

2013-02-28 Thread Nick99
Hello,

Any plans for the fix/workaround? 

I can only think of some pretty messy workarounds like moving my CLOB 
fields to 
a) just VARCHAR(*255*) /though the docs say *The maximum precision is 
Integer.MAX_VALUE<http://www.h2database.com/html/datatypes.html#varchar_type>
*/ 
b) or to BLOB (may behave the same way as CLOB) 
c) or to BINARY (looks promising).



On Tuesday, December 4, 2012 6:59:08 PM UTC+2, Nick99 wrote:
>
> It seems the problem is with MVCC.
>
> The test is not failing for 30s on my system with: "jdbc:h2:db/test01;MVCC=
> *FALSE*;MULTI_THREADED=0;LOCK_MODE=3;LOCK_TIMEOUT=2;"
>
> All isolation levels fail for (in the 1-5s 
> timeframe): "jdbc:h2:db/test01;MVCC=*TRUE;*
> MULTI_THREADED=0;LOCK_MODE=3;LOCK_TIMEOUT=2;" 
> Connection.TRANSACTION_READ_UNCOMMITTED
> Connection.TRANSACTION_READ_COMMITTED
> Connection.TRANSACTION_REPEATABLE_READ
> Connection.TRANSACTION_SERIALIZABLE
>
> On Tuesday, December 4, 2012 11:01:37 AM U
> TC+2, Noel Grandin wrote:
>>
>> Hmmm, I think what is happening here is that when in MVCC mode with 
>> transaction isolation level TRANSACTION_READ_COMMITTED, the session is 
>> somehow seeing LOB entries that have already been deleted. 
>>
>> Thomas, does that ring any bells? 
>>
>> I've been through the code paths that end up in LobStorage, but I can't 
>> see any obvious problems. 
>>
>> On 2012-12-03 09:58, Noel Grandin wrote: 
>> > Nice work on creating the test case! 
>> > 
>> > Interesting, this is a genuine bug somewhere in the LOB code, and it 
>> > manifests even with MVCC=false. 
>> > 
>> > The only short-term fix I can see is to set your transaction isolation 
>> > to  TRANSACTION_REPEATABLE_READ. 
>> > 
>> > Thomas, I further reduced the test-case, and I'm including it here. 
>> > Note that (for me) it did not fail every single time. I normally let 
>> > it run for about 15 seconds, and then terminate and try again. 
>> > I get a failure rate of about 50%. 
>> > 
>>
>>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to h2-database+unsubscr...@googlegroups.com.
To post to this group, send email to h2-database@googlegroups.com.
Visit this group at http://groups.google.com/group/h2-database?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.




Re: Concurrent operations on LOBs

2012-12-04 Thread Nick99
It seems the problem is with MVCC.

The test is not failing for 30s on my system with: "jdbc:h2:db/test01;MVCC=*
FALSE*;MULTI_THREADED=0;LOCK_MODE=3;LOCK_TIMEOUT=2;"

All isolation levels fail for (in the 1-5s 
timeframe): "jdbc:h2:db/test01;MVCC=*TRUE;*
MULTI_THREADED=0;LOCK_MODE=3;LOCK_TIMEOUT=2;" 
Connection.TRANSACTION_READ_UNCOMMITTED
Connection.TRANSACTION_READ_COMMITTED
Connection.TRANSACTION_REPEATABLE_READ
Connection.TRANSACTION_SERIALIZABLE

On Tuesday, December 4, 2012 11:01:37 AM U
TC+2, Noel Grandin wrote:
>
> Hmmm, I think what is happening here is that when in MVCC mode with 
> transaction isolation level TRANSACTION_READ_COMMITTED, the session is 
> somehow seeing LOB entries that have already been deleted. 
>
> Thomas, does that ring any bells? 
>
> I've been through the code paths that end up in LobStorage, but I can't 
> see any obvious problems. 
>
> On 2012-12-03 09:58, Noel Grandin wrote: 
> > Nice work on creating the test case! 
> > 
> > Interesting, this is a genuine bug somewhere in the LOB code, and it 
> > manifests even with MVCC=false. 
> > 
> > The only short-term fix I can see is to set your transaction isolation 
> > to  TRANSACTION_REPEATABLE_READ. 
> > 
> > Thomas, I further reduced the test-case, and I'm including it here. 
> > Note that (for me) it did not fail every single time. I normally let 
> > it run for about 15 seconds, and then terminate and try again. 
> > I get a failure rate of about 50%. 
> > 
>
>

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/h2-database/-/1otUFfQ80QsJ.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: Concurrent operations on LOBs

2012-11-20 Thread Nick99
> (3) reading from that ResultSet 

Do you mean doTask4()? The following code

tx.commit();
session.close();

session = sessionFactory.openSession();

commits the session, and then opens it again (in a new connection, 
perhaps). The other thread (doTask3()) just reads from another session 
(connection?). There is some pooling involved, so I'm not sure if 
session=connection here.




On Tuesday, November 20, 2012 4:02:33 PM UTC+2, Noel Grandin wrote:
>
>  Judging from the code paths involved, your code is 
>
> (1) opening a ResultSet
> (2) calling commit() on that connection
> (3) reading from that ResultSet
>
> which is illegal.
>
> In general, multi-thread apps should be using one connection per thread.
>
> From experience, I can tell you that Hibernate is not a good match for a 
> desktop-style multi-threaded application (I build lots of them).
>
> For that reason, we use SimpleORM as our mapping layer to the database.
>
> On 2012-11-16 22:33, Nick99 wrote:
>  
> Okay, it seems I've isolated the source of missing lobs/LOB NPEs/missing 
> lob entry problems. At this point I cannot attach a compilable project, 
> just the test code and the trace log. 
>
>  Environment:
> 2-core CPU
> Java x32 1.6.27
> h2-1.3.169 (*embedded*)
> c3p0-0.9.1.2
> hibernate-core-3.6.10
>  spring 3.1.2
>
>  The test cases creates an instance of a certain db-mapped class. The 
> class contains a CLOB field along with some dummy field.
> The test then starts 2 threads: the first one is reading the instance 
> periodically, the other is updating it (periodically too). The CLOB field 
> is not updated - the issue seems to not depend on it.
> After about 1-5s of test run something bad happens (NPE/missing LOB/etc).
>
>  *I'm attaching the trace log (lvl 3), the database (state: the java 
> process was stopped from IDE after the exception), the test case. *The 
> db2.zip is the same stuff but with the failure happening almost immediately 
> after start.
>
>  The test case requires some initial Spring/Hibernate/C3P0 configuration 
> (e.g. hibernate.hbm2ddl.auto=update, etc), so if that's too much - I can to 
> create a standalone project with all the deps included & send it. It may 
> also be possible to recreate the test using plain JDBC, not the full Spring 
> stack.
>
>  HTH; this (or similar) issue seems to be pretty popular recently.
>
>  Thank you.
> -- 
> You received this message because you are subscribed to the Google Groups 
> "H2 Database" group.
> To view this discussion on the web visit 
> https://groups.google.com/d/msg/h2-database/-/d9jyaefh7XsJ.
> To post to this group, send email to h2-da...@googlegroups.com
> .
> To unsubscribe from this group, send email to 
> h2-database...@googlegroups.com .
> For more options, visit this group at 
> http://groups.google.com/group/h2-database?hl=en.
>
>
>  

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/h2-database/-/r4zaoJQuX6YJ.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: Missing Lob Entry

2012-11-16 Thread Nick99
I can try to provide the info, if needed ;)
(here https://groups.google.com/d/msg/h2-database/LuYRx84vFIc/d9jyaefh7XsJ)

On Friday, August 31, 2012 6:35:51 PM UTC+3, Thomas Mueller wrote:
>
> Hi,
>
> I'm sorry for the delay.
>
> This looks like a corrupt database. To recover the data, use the tool 
> org.h2.tools.Recover to create the SQL script file, and then re-create the 
> database using this script. Does it work when you do this?
>  
> I am very interested in analyzing and solving this problem. Corruption 
> problems have top priority for me. I have a few questions:
>
> - What is your database URL?
> - Did you use LOG=0 or LOG=1? Did you read the FAQ about it?
> - Did the system ever run out of disk space?
> - Could you send the full stack trace of the exception including message 
> text?
> - Did you use SHUTDOWN DEFRAG or the database setting DEFRAG_ALWAYS with 
> H2 version 1.3.159 or older?
> - How many connections does your application use concurrently?
> - Do you use temporary tables?
> - With which version of H2 was this database created?
> You can find it out using:
> select * from information_schema.settings where name='CREATE_BUILD'
> or have a look in the SQL script created by the recover tool.
> - Did the application run out of memory (once, or multiple times)?
> - Do you use any settings or special features (for example cache settings,
> two phase commit, linked tables)?
> - Do you use any H2-specific system properties?
> - Is the application multi-threaded?
> - What operating system, file system, and virtual machine
> (java -version) do you use?
> - How did you start the Java process (java -Xmx... and so on)?
> - Is it (or was it at some point) a networked file system?
> - How big is the database (file sizes)?
> - How much heap memory does the Java process have?
> - Is the database usually closed normally, or is process terminated
> forcefully or the computer switched off?
> - Is it possible to reproduce this problem using a fresh database
> (sometimes, or always)?
> - Are there any other exceptions (maybe in the .trace.db file)?
> Could you send them please?
> - Do you still have any .trace.db files, and if yes could you send them?
> - Could you send the .h2.db file where this exception occurs?
>
> Regards,
>
> Thomas
>
> On Mon, Aug 13, 2012 at 9:07 PM, bdeen  >wrote:
>
>> I'm running with h2 h2-1.3.166.jar.  I'm getting the following.  The 
>> only thing I see on this issue is that this was suppose to be fixed in the 
>> 159 version.  Anyone see this and know what the actual issue is, I've used 
>> the error identifier on h2database and it says an io error occurred. I'm 
>> getting this at the very end of my unit test run after using the table 
>> structure to create/update/delete local cache entries.
>>
>>
>>
>> org.h2.jdbc.JdbcSQLException: IO Exception: "java.io.IOException: 
>> org.h2.jdbc.JdbcSQLException: IO Exception: ""Missing lob entry: 4/14"" 
>> [90028-166]"; "lob: null table: 16 id: 4" [90031-166]
>>  at org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
>> at org.h2.message.DbException.get(DbException.java:158)
>>  at org.h2.message.DbException.convertIOException(DbException.java:315)
>> at org.h2.value.ValueLobDb.getBytesNoCopy(ValueLobDb.java:229)
>>  at org.h2.value.ValueLobDb.getBytes(ValueLobDb.java:214)
>> at org.h2.jdbc.JdbcResultSet.getBytes(JdbcResultSet.java:970)
>>  at 
>> com.j256.ormlite.jdbc.JdbcDatabaseResults.getBytes(JdbcDatabaseResults.java:106)
>> at 
>> com.j256.ormlite.field.types.StringBytesType.resultToSqlArg(StringBytesType.java:41)
>>  at 
>> com.j256.ormlite.field.BaseFieldConverter.resultToJava(BaseFieldConverter.java:24)
>> at com.j256.ormlite.field.FieldType.resultToJava(FieldType.java:761)
>>  at 
>> com.j256.ormlite.stmt.mapped.BaseMappedQuery.mapRow(BaseMappedQuery.java:60)
>> at 
>> com.j256.ormlite.stmt.StatementExecutor.queryForFirst(StatementExecutor.java:96)
>>  at com.j256.ormlite.dao.BaseDaoImpl.queryForFirst(BaseDaoImpl.java:229)
>> at com.j256.ormlite.stmt.QueryBuilder.queryForFirst(QueryBuilder.java:269)
>>  at DocScannerMain.getFalconData(Unknown Source)
>> at DocScannerMain$UpdateCache.run(Unknown Source)
>> at 
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
>>  at 
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
>> at 
>> java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:573)
>>  at java.security.AccessController.doPrivileged(Native Method)
>> at 
>> java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:570)
>>  at java.lang.Thread.run(Thread.java:680)
>> Caused by: java.io.IOException: org.h2.jdbc.JdbcSQLException: IO 
>> Exception: "Missing lob entry: 4/14" [90028-166]
>>  at org.h2.message.DbException.convertToIOException(DbException.java:348)
>> at org.h2.store.LobStorage$LobInputStream.fillBuffer(LobStorage.java:464)
>>  at org.h2.store.LobStorage$LobI

Re: Concurrent operations on LOBs

2012-11-15 Thread Nick99
 The resultset returned by

com.mchange.v2.c3p0.impl.NewProxyPreparedStatement
public final java.sql.ResultSet executeQuery() throws java.sql.SQLException 
{ /* compiled code */ } 

has

   - currentRow = {org.h2.value.Value[125]@13167} 
   - [0] = {org.h2.value.ValueLong@13177}"34" 
   - [1] = {org.h2.value.ValueString@13178}"'---'" 
   - [2] = {org.h2.value.ValueString@13178}"' --- '" 
   - [3] = {org.h2.value.ValueString@13179}"'2012-320T16:03:34.250'" 
   - [4] = {org.h2.value.ValueString@13180}"' --- " 
   - [5] = {org.h2.value.ValueBoolean@13181}"TRUE" 
   - [6] = {org.h2.value.ValueBoolean@13181}"TRUE" 
   - [7] = {org.h2.value.ValueLong@13182}"37" 
   - [8] = {org.h2.value.ValueBoolean@13181}"TRUE" 
   - [9] = {org.h2.value.ValueBoolean@13181}"TRUE" 
   - [10] = {org.h2.value.ValueLobDb@13183}"lob: null table: 0 id: 0" 
   - [11] = {org.h2.value.ValueLobDb@13184}"lob: null table: 0 id: 0" 
   - [12] = {org.h2.value.ValueBoolean@13181}"TRUE" 
   - [13] = {org.h2.value.ValueString@13185}" --- " 
   - [14] = {org.h2.value.ValueInt@13186}"3" 
   - [15] = {org.h2.value.ValueBoolean@13181}"TRUE" 
   - *[16] = {org.h2.value.ValueLobDb@9968}"lob: null table: -1 id: 158" *

 

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/h2-database/-/8xe5S8bNVCkJ.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



Re: Concurrent operations on LOBs

2012-11-15 Thread Nick99
I think I can more or less reproduce the problem. It [sometimes, ~10%] 
happens when I load a fairly complex Hibernate-wired object 2 times with 
very low delay between loads (sub 50ms).

On the 2d read I managed to break at #291 of ValueLobDb.java when 
lobStorage==null. "this" dump:


   - this = {org.h2.value.ValueLobDb@9968}"lob: null table: -1 id: 158" 
   - type = 16 
   - precision = 1670 
   - tableId = -1 
   - hash = 0 
   - lobStorage = null 
   - lobId = 158 
   - hmac = null 
   - small = null 
   - handler = null 
   - tempFile = null 
   - fileName = null 

I'll keep you posted.

On Tuesday, November 13, 2012 9:12:52 PM UTC+2, Thomas Mueller wrote:
>
> Hi,
>
> It seems the CLOB is closed, but I'm not sure why that would be, because 
> the result set is still open it seems. I'm afraid I don't know what could 
> be the problem in this case.
>
> Regards,
> Thomas
>
>
> On Tue, Nov 13, 2012 at 4:50 PM, Nick99 
> > wrote:
>
>> hi,
>>
>> I think I bumped into a similar bug. I have a multithreaded app; an 
>> instance of some class is updated; then it is loaded and an NPE is thrown 
>> by H2. I use #169, Windows 7, NTFS.
>>
>> I cannot provide a test case at the moment; nor can I reproduce it again.
>>
>> Could you please look what can be wrong?
>>
>> Thank you.
>>
>>
>> Appendix 1
>> database.driverclass=org.h2.Driver
>>
>> database.url=jdbc\:h2\:userdata/db/product01;MVCC\=TRUE;MULTI_THREADED\=0;LOCK_MODE\=3;LOCK_TIMEOUT\=2
>> database.dialect=org.hibernate.dialect.H2Dialect
>> database.usr=
>> database.pass=
>>
>>
>> Appendix 2
>> 2012-11-12 13:01:53,412 [err] 
>> org.hibernate.exception.GenericJDBCException: could not load an entity: 
>> [com.company.product.Instance#1]
>> [...]
>> 2012-11-12 13:01:53,412 [err] Caused by: org.h2.jdbc.JdbcSQLException: 
>> General error: "java.lang.NullPointerException" [5-169]
>> 2012-11-12 13:01:53,412 [err] at 
>> org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.h2.message.DbException.get(DbException.java:158)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.h2.message.DbException.convert(DbException.java:281)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.h2.message.DbException.toSQLException(DbException.java:254)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.h2.message.TraceObject.logAndConvert(TraceObject.java:368)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.h2.jdbc.JdbcResultSet.getString(JdbcResultSet.java:293)
>> 2012-11-12 13:01:53,412 [err] at 
>> com.mchange.v2.c3p0.impl.NewProxyResultSet.getString(NewProxyResultSet.java:3342)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.hibernate.type.descriptor.sql.VarcharTypeDescriptor$2.doExtract(VarcharTypeDescriptor.java:61)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:254)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:250)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:230)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:331)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2283)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1527)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1455)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.hibernate.loader.Loader.getRow(Loader.java:1355)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:611)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.hibernate.loader.Loader.doQuery(Loader.java:829)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
>> 2012-11-12 13:01:53,412 [err] at 
>> org.hibernate.loader.Loader.loadEntity(Loader.java:2037)
>> 2012-11-12 13:01:53,412 [err] ... 54 more
>> 2012-11-12 13:01:53,412 [err] Caused by: java.lang.NullPointerException
>> 2012-11-12 13:01:53,412 [err] at 
>> org.h2.value.ValueLobDb.getInputStream(ValueLobD

Re: Concurrent operations on LOBs

2012-11-13 Thread Nick99
hi,

I think I bumped into a similar bug. I have a multithreaded app; an 
instance of some class is updated; then it is loaded and an NPE is thrown 
by H2. I use #169, Windows 7, NTFS.

I cannot provide a test case at the moment; nor can I reproduce it again.

Could you please look what can be wrong?

Thank you.


Appendix 1
database.driverclass=org.h2.Driver
database.url=jdbc\:h2\:userdata/db/product01;MVCC\=TRUE;MULTI_THREADED\=0;LOCK_MODE\=3;LOCK_TIMEOUT\=2
database.dialect=org.hibernate.dialect.H2Dialect
database.usr=
database.pass=


Appendix 2
2012-11-12 13:01:53,412 [err] org.hibernate.exception.GenericJDBCException: 
could not load an entity: [com.company.product.Instance#1]
[...]
2012-11-12 13:01:53,412 [err] Caused by: org.h2.jdbc.JdbcSQLException: 
General error: "java.lang.NullPointerException" [5-169]
2012-11-12 13:01:53,412 [err] at 
org.h2.message.DbException.getJdbcSQLException(DbException.java:329)
2012-11-12 13:01:53,412 [err] at 
org.h2.message.DbException.get(DbException.java:158)
2012-11-12 13:01:53,412 [err] at 
org.h2.message.DbException.convert(DbException.java:281)
2012-11-12 13:01:53,412 [err] at 
org.h2.message.DbException.toSQLException(DbException.java:254)
2012-11-12 13:01:53,412 [err] at 
org.h2.message.TraceObject.logAndConvert(TraceObject.java:368)
2012-11-12 13:01:53,412 [err] at 
org.h2.jdbc.JdbcResultSet.getString(JdbcResultSet.java:293)
2012-11-12 13:01:53,412 [err] at 
com.mchange.v2.c3p0.impl.NewProxyResultSet.getString(NewProxyResultSet.java:3342)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.type.descriptor.sql.VarcharTypeDescriptor$2.doExtract(VarcharTypeDescriptor.java:61)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.type.descriptor.sql.BasicExtractor.extract(BasicExtractor.java:64)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:254)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:250)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.type.AbstractStandardBasicType.nullSafeGet(AbstractStandardBasicType.java:230)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.type.AbstractStandardBasicType.hydrate(AbstractStandardBasicType.java:331)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2283)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1527)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1455)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.loader.Loader.getRow(Loader.java:1355)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:611)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.loader.Loader.doQuery(Loader.java:829)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:274)
2012-11-12 13:01:53,412 [err] at 
org.hibernate.loader.Loader.loadEntity(Loader.java:2037)
2012-11-12 13:01:53,412 [err] ... 54 more
2012-11-12 13:01:53,412 [err] Caused by: java.lang.NullPointerException
2012-11-12 13:01:53,412 [err] at 
org.h2.value.ValueLobDb.getInputStream(ValueLobDb.java:291)
2012-11-12 13:01:53,412 [err] at 
org.h2.value.ValueLobDb.getReader(ValueLobDb.java:277)
2012-11-12 13:01:53,412 [err] at 
org.h2.value.ValueLobDb.getString(ValueLobDb.java:198)
2012-11-12 13:01:53,412 [err] at 
org.h2.jdbc.JdbcResultSet.getString(JdbcResultSet.java:291)
2012-11-12 13:01:53,412 [err] ... 69 more


-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To view this discussion on the web visit 
https://groups.google.com/d/msg/h2-database/-/SUnfsf55Dk0J.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.



ALTER TABLE ... DROP COLUMN IF EXISTS misbehaves?

2011-07-14 Thread Nick99
Hi,

H2 1.3.157

I'm trying to drop a column /via console/ if it exists:

>ALTER TABLE TEST DROP COLUMN IF EXISTS 'UUID'
>Column "IF" not found; SQL statement:
ALTER TABLE TEST DROP COLUMN IF EXISTS 'UUID' [42122-154] 42S22/42122
(Help)

however,  
http://www.h2database.com/html/grammar.html?highlight=grammar&search=gramm#alter_table_drop_column
states that "IF EXISTS" is a valid token.

Any help would be appreciated.

Thanks!

-- 
You received this message because you are subscribed to the Google Groups "H2 
Database" group.
To post to this group, send email to h2-database@googlegroups.com.
To unsubscribe from this group, send email to 
h2-database+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/h2-database?hl=en.