History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: QUARTZ-560
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Major Major
Assignee: James House
Reporter: Martin Vysny
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
Quartz Scheduler

Trigger with empty JobDataMap can't be loaded in Derby and HSQLDB

Created: 09/Feb/07 06:52 AM   Updated: 21/Oct/07 02:38 PM
Component/s: Job Stores
Affects Version/s: 1.6
Fix Version/s: 1.6.1

File Attachments: 1. Zip Archive QUARTZ-560.zip (3 kb)

Environment: java 1.5.0.10, linux
Issue Links:
Related
This issue relates to:
QUARTZ-513 EOFException being throw in StdJDBCDe... Critical Closed
QUARTZ-566 MSSQLDelegate.getObjectFromBlob throw... Critical Closed
 


 Description  « Hide
This bug is similar to QUARTZ-421, I tested it with HSQLDB 1.7.3.3, 1.8.0.7 and Derby 10.2.2.0. The stacktrace of failure with HSQLDB:

org.quartz.JobPersistenceException: Couldn't acquire next trigger: Couldn't retrieve trigger: null [See nested exception: org.quartz.JobPersistenceException: Couldn't retrieve trigger: null [See nested exception: java.io.EOFException]]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport .java:2700)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$35.execute(JobStoreSupport.java:26 58)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStore Support.java:3662)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport .java:2654)
at org.quartz.core.QuartzSchedulerThread.run(QuartzSchedulerThread.java:235)
Caused by: org.quartz.JobPersistenceException: Couldn't retrieve trigger: null [See nested exception: java.io.EOFException]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.ja va:1508)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.ja va:1484)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.acquireNextTrigger(JobStoreSupport .java:2688)
... 4 more
Caused by: java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2228 )
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java :2694)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:761)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:277)
at org.quartz.impl.jdbcjobstore.HSQLDBDelegate.getObjectFromBlob(HSQLDBDelegate.ja va:102)
at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectTrigger(StdJDBCDelegate.java :2132)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.ja va:1490)
... 6 more


Stacktrace of failure with Derby:

org.quartz.JobPersistenceException: Couldn't retrieve trigger: null [See nested exception: java.io.EOFException]
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1508)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.recoverMisfiredJobs(JobStoreSupport.java:891)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.doRecoverMisfires(JobStoreSupport.java:3029)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.manage(JobStoreSupport.java:3789)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$MisfireHandler.run(JobStoreSupport.java:3809)
Caused by: java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(ObjectInputStream.java:2228)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(ObjectInputStream.java:2694)
at java.io.ObjectInputStream.readStreamHeader(ObjectInputStream.java:761)
at java.io.ObjectInputStream.<init>(ObjectInputStream.java:277)
at org.quartz.impl.jdbcjobstore.CloudscapeDelegate.getObjectFromBlob(CloudscapeDelegate.java:104)
at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectTrigger(StdJDBCDelegate.java:2132)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1490)
... 4 more

The bug may be circumvented by setting a non-empty JobDataMap to the trigger.

 All   Comments   Change History      Sort Order:
Henri Yandell - [01/Mar/07 06:57 PM ]
I can repro this, but it's not guaranteed.

I also seem to be able to repro it even with the non-empty JobDataMap.

Repro attached. The runsql bit is a hacky bit of Java I have to shove SQL into databases, I presume you have your own way to push the data into Derby.

Henri Yandell - [01/Mar/07 07:23 PM ]

Henri Yandell - [05/Mar/07 03:34 PM ]
A bit more testing and now it makes sense.

If the JobData is null, the serializeObject + setBytes code is such that an empty ByteArrayOutputStream.toByteArray() gets inserted and not null. This shouldn't be an issue because even if null gets into setBytes then it will a new byte[0]. However when getObjectFromBlob in CloudscapeDelegate reads this it only checks for inputBytes being null and not for it being an empty byte array. So for the CloudscapeDelegate the custom code needs to be changed to also check for an empty array. The PostgreSQLDelegate already contains this fix.

For the HSQLDelegate I would hazard that the binaryInput.available() == 0 check found in the StdJDBCDelegate would be needed here. The PointBaseDelegate and MSSQLDelegate both look like they could also do with the binaryInput.available check.

Henri Yandell - [05/Mar/07 03:45 PM ]
Additionally, the StdJDBCDelegate class seems to work fine against the latest version of Derby so the CloudscapeDelegate class can have its implementation of the method removed and be deprecated/removed if you ask me :)

Sven Schliesing - [07/Aug/07 02:50 AM ]
This bug is marked as fixed in 1.6.1. So I checked out the current trunk and compared CloudscapeDelegate and StdJDBCDelegate with their versions from the 1.6.0-tag. No difference except a new linebreak in StdJDBCDelegate.

Is this bug really fixed?

Henri Yandell - [08/Aug/07 10:45 AM ]

It's marked as 'fix for 1.6.1'. It's still open, so not fixed until the issue is resolved or closed fixed.

Sven Schliesing - [09/Aug/07 01:04 AM ]
Oh, ok. Sorry, my fault.

Paul Boudreaux - [30/Aug/07 08:22 PM ]
I believe I've got the same issue using the MSSQLDelegate... here's part of the stack trace...

java.io.EOFException
at java.io.ObjectInputStream$PeekInputStream.readFully(Unknown Source)
at java.io.ObjectInputStream$BlockDataInputStream.readShort(Unknown Source)
at java.io.ObjectInputStream.readStreamHeader(Unknown Source)
at java.io.ObjectInputStream.<init>(Unknown Source)
at org.quartz.impl.jdbcjobstore.MSSQLDelegate.getObjectFromBlob(MSSQLDelegate.java:88)
at org.quartz.impl.jdbcjobstore.StdJDBCDelegate.selectTrigger(StdJDBCDelegate.java:2132)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.retrieveTrigger(JobStoreSupport.java:1490)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.recoverMisfiredJobs(JobStoreSupport.java:891)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.recoverJobs(JobStoreSupport.java:780)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$2.execute(JobStoreSupport.java:752)
at org.quartz.impl.jdbcjobstore.JobStoreSupport$40.execute(JobStoreSupport.java:3628)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3662)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.executeInNonManagedTXLock(JobStoreSupport.java:3624)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.recoverJobs(JobStoreSupport.java:748)
at org.quartz.impl.jdbcjobstore.JobStoreSupport.schedulerStarted(JobStoreSupport.java:573)
at org.quartz.core.QuartzScheduler.start(QuartzScheduler.java:449)
...

Henri Yandell - [06/Sep/07 12:04 PM ]
Paul - yep, that one is QUARTZ-566. We've three issues which pretty much amount to 'empty job data screws the delegates on many databases'.

James House - [21/Oct/07 02:38 PM ]

I've spent a fair amount of time this weekend testing the fixes to the delegates (CloudscapeDelegate, MSSQLDelegate, PointbaseDelegate, StdJDBCDelegate).

All seems to work fine now, so far as I can tell, though there's sometimes variations once people try things with different releases of those DBs. Hopefully the empty stream, byte array checks have done the trick across the board.


Closing QUARTZ-560, QUARTZ-566, and QUARTZ-513 (all related to this issue).

Also, marked the CloudscapeDelegate deprecated.