Bug 1380766

Summary: encounterring an "IOException: negative tag value" from Job cron group.CertificateRevocationListTask
Product: [Community] Candlepin Reporter: John Sefler <jsefler>
Component: candlepinAssignee: Alex Wood <awood>
Status: CLOSED CURRENTRELEASE QA Contact: Katello QA List <katello-qa-list>
Severity: high Docs Contact:
Priority: high    
Version: 2.0CC: csnyder, redakkan, skallesh, vrjain
Target Milestone: ---Keywords: Triaged
Target Release: 2.0   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: candlepin-2.0.20-1 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-11-16 09:18:32 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description John Sefler 2016-09-30 14:07:27 UTC
Description of problem:

I really don't know how my candlepin server got into this state, but it has recently happened twice after a day of running automated tests against an local candlepin deployed with TESTDATA from master.  At this time tomcat appears to get overloaded and a simple curl to get the candlepin/status just hangs.  Restarting the tomcat service helps to get the candlepin server responsive again.  That's when we found this traceback repeatedly being logged in candlepin.log....


pasted from /var/log/candlepin/candlepin.log

2016-09-29 13:44:01,675 [thread=QuartzScheduler_Worker-8] [job=CertificateRevocationListTask-68298dcc-2605-4eef-8ff7-882ec92d66e6, org=] ERROR org.quartz.core.JobRunShell - Job cron group.CertificateRevocationListTask-68298dcc-2605-4eef-8ff7-882ec92d66e6 threw an unhandled Exception:
java.lang.RuntimeException: java.io.IOException: negative tag value
        at org.candlepin.util.X509CRLEntryStream.next(X509CRLEntryStream.java:226) ~[X509CRLEntryStream.class:na]
        at org.candlepin.util.X509CRLStreamWriter.preScan(X509CRLStreamWriter.java:247) ~[X509CRLStreamWriter.class:na]
        at org.candlepin.util.CrlFileUtil.updateCRLFile(CrlFileUtil.java:220) ~[CrlFileUtil.class:na]
        at org.candlepin.util.CrlFileUtil.syncCRLWithDB(CrlFileUtil.java:314) ~[CrlFileUtil.class:na]
        at org.candlepin.pinsetter.tasks.CertificateRevocationListTask.toExecute(CertificateRevocationListTask.java:69) ~[CertificateRevocationListTask.class:na]
        at org.candlepin.pinsetter.tasks.KingpinJob.execute(KingpinJob.java:84) ~[KingpinJob.class:na]
        at org.quartz.core.JobRunShell.run(JobRunShell.java:202) ~[quartz-2.2.1.jar:na]
        at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:573) [quartz-2.2.1.jar:na]
Caused by: java.io.IOException: negative tag value
        at org.candlepin.util.DERUtil.readTag(DERUtil.java:116) ~[DERUtil.class:na]
        at org.candlepin.util.X509CRLEntryStream.next(X509CRLEntryStream.java:189) ~[X509CRLEntryStream.class:na]
        ... 7 common frames omitted


Version-Release number of selected component (if applicable):
[root@jsefler-candlepin7 candlepin]# git log | head -1
commit df3e39a0227f2dd3c1d7484ae9f9344066ca90d0

Comment 2 Alex Wood 2016-10-04 18:31:54 UTC
commit 8712e7f8c77204a9c0f51eef4e5b23f3dc1adc0c
Author: Alex Wood <awood>
Date:   Tue Oct 4 11:23:32 2016 -0400

    1380766: Correct improper calculation of extensions delta.
    
    The CRL extensions are converted to DER internally.  Previously the code
    was accounting for the difference between the length of the byte arrays
    and the change in the length in the number of bytes used to express the
    length of the sequence.  Since the extensions were already converted to
    DER, the change in the number of length bytes was included in the raw
    difference already.
    
    This patch removes the double-counting of bytes that was occurring
    previously.