Bug 1358742
| Summary: | UniqueTag cannot be cast to Function | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [Community] Candlepin (Migrated to Jira) | Reporter: | Filip Nguyen <fnguyen> | ||||||
| Component: | candlepin | Assignee: | Filip Nguyen <fnguyen> | ||||||
| Status: | CLOSED CURRENTRELEASE | QA Contact: | Katello QA List <katello-qa-list> | ||||||
| Severity: | unspecified | Docs Contact: | |||||||
| Priority: | unspecified | ||||||||
| Version: | 0.9.51 | CC: | bcourt, mstead, redakkan, skallesh | ||||||
| Target Milestone: | --- | ||||||||
| Target Release: | 0.9.51 | ||||||||
| Hardware: | Unspecified | ||||||||
| OS: | Unspecified | ||||||||
| Whiteboard: | |||||||||
| Fixed In Version: | candlepin-0.9.51.20-1 | Doc Type: | If docs needed, set a value | ||||||
| Doc Text: | Story Points: | --- | |||||||
| Clone Of: | |||||||||
| : | 1369188 1369195 (view as bug list) | Environment: | |||||||
| Last Closed: | 2017-01-03 14:14:21 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: | |||||||
| Embargoed: | |||||||||
| Bug Depends On: | |||||||||
| Bug Blocks: | 1369195 | ||||||||
| Attachments: |
|
||||||||
Created attachment 1182448 [details]
candlepin.log
Created attachment 1182449 [details]
error.log
The bug is in JsRunnerProvider.compileRules method. The method is skipping compilation of rules, based on the timestamp of the last rules update:
if (newUpdated.equals(this.updated)) {
return;
}
This assumption fails with rules_import_spec where we RulesResource.upload()/RulesResource.delete() the rules quickly. In addition to that, Mysql stores updated timestamp only with second precision, making the probability of this failing even higher.
See trace [1], the compilation is skipped when deleting rules at 15:05:58,965
[1]
2016-07-21 15:05:58,823 [thread=http-bio-8443-exec-1] [req=c3c79dd8-6e20-4391-9815-0ed369b5189c, org=] INFO org.candlepin.resource.RulesResource - RulesResource.upload is about to compile rules after rules upload
2016-07-21 15:05:58,824 [thread=http-bio-8443-exec-1] [req=c3c79dd8-6e20-4391-9815-0ed369b5189c, org=] INFO org.candlepin.policy.js.JsRunnerProvider - Recompiling rules with timestamp: 2016-07-21 15:05:59.0
2016-07-21 15:05:58,833 [thread=http-bio-8443-exec-1] [req=c3c79dd8-6e20-4391-9815-0ed369b5189c, org=] INFO org.candlepin.policy.js.JsRunnerProvider - Compiled rules, newupdated: 2016-07-21 15:05:59.0, oldupdated: 2016-07-21 15:05:56.0
2016-07-21 15:05:58,964 [thread=http-bio-8443-exec-10] [req=24227fc5-34e1-4e44-94c5-6ae38e32f9a7, org=] INFO org.candlepin.resource.RulesResource - RulesResource.delete is about to compile rules after rules delete
2016-07-21 15:05:58,965 [thread=http-bio-8443-exec-10] [req=24227fc5-34e1-4e44-94c5-6ae38e32f9a7, org=] INFO org.candlepin.policy.js.JsRunnerProvider - Skipping compilation! Updated: 2016-07-21 15:05:59.0
|
Description of problem: The error [1] is similar to 751101, 743968. I have seen it only on MySQL. It also seems to be a timing issue, not reproducible every time. [1] 1) Error injecting constructor, java.lang.ClassCastException: org.mozilla.javascript.UniqueTag cannot be cast to org.mozilla.javascript.Function at org.candlepin.policy.js.activationkey.ActivationKeyRules.<init>(ActivationKeyRules.java:46) while locating org.candlepin.policy.js.activationkey.ActivationKeyRules for parameter 14 at org.candlepin.controller.CandlepinPoolManager.<init>(CandlepinPoolManager.java:121) while locating org.candlepin.controller.CandlepinPoolManager while locating org.candlepin.controller.PoolManager for parameter 7 at org.candlepin.sync.Importer.<init>(Importer.java:142) while locating org.candlepin.sync.Importer for parameter 10 at org.candlepin.resource.OwnerResource.<init>(OwnerResource.java:184) while locating org.candlepin.resource.OwnerResource Caused by: java.lang.ClassCastException: org.mozilla.javascript.UniqueTag cannot be cast to org.mozilla.javascript.Function at org.candlepin.policy.js.JsRunner.init(JsRunner.java:58) at org.candlepin.policy.js.activationkey.ActivationKeyRules.<init>(ActivationKeyRules.java:51) at org.candlepin.policy.js.activationkey.ActivationKeyRules$$FastClassByGuice$$60861e0c.newInstance(<generated>) at com.google.inject.internal.cglib.reflect.$FastConstructor.newInstance(FastConstructor.java:40) at com.google.inject.internal.DefaultConstructionProxyFactory$1.newInstance(DefaultConstructionProxyFactory.java:60) at com.google.inject.internal.ConstructorInjector.construct(ConstructorInjector.java:85) at Version-Release number of selected component (if applicable): How reproducible: Sometimes Steps to Reproduce: 1. Configure Candlepin against MySQL 2. buildr rspec:rules_import_spec:'posts and gets rules' 3. buildr rspec:serialization_spec:'references pool as a link' Actual results: Exception Expected results: No Exception Additional info: