Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error compiling assets: MALFORMED #93

Closed
gregopet opened this issue May 18, 2016 · 4 comments
Closed

Error compiling assets: MALFORMED #93

gregopet opened this issue May 18, 2016 · 4 comments

Comments

@gregopet
Copy link

We've been having occasional trouble compiling assets under Grails, the process fails with the following stacktrace (I'm leaving out the Gradle part):

    Caused by: java.lang.IllegalArgumentException: MALFORMED
    at asset.pipeline.fs.JarAssetResolver.scanForFiles(JarAssetResolver.groovy:145)
    at asset.pipeline.fs.AssetResolver$scanForFiles.call(Unknown Source)
    at asset.pipeline.fs.AssetResolver$scanForFiles.call(Unknown Source)
    at asset.pipeline.AssetCompiler$_getAllAssets_closure6.doCall(AssetCompiler.groovy:340)
    at asset.pipeline.AssetCompiler.getAllAssets(AssetCompiler.groovy:339)
    at asset.pipeline.AssetCompiler.compile(AssetCompiler.groovy:121)
    at asset.pipeline.AssetCompiler$compile.call(Unknown Source)
    at asset.pipeline.gradle.AssetCompile.compile(AssetCompile.groovy:209)
    at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.doExecute(AnnotationProcessingTaskFactory.java:227)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:220)
    at org.gradle.api.internal.project.taskfactory.AnnotationProcessingTaskFactory$StandardTaskAction.execute(AnnotationProcessingTaskFactory.java:209)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:585)
    at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:568)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
    at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
    ... 68 more

This error randomly starts showing up on certain developer machines and on our Teamcity build server. Deleting the build folder doesn't help, what usually does do the trick is to upgrade/downgrade the asset pipeline version (we're currently at asset-pipeline:3.2.1 and asset-pipeline-gradle:2.8.2) - this helps for a while, I've just downgraded to asset-pipeline-gradle:2.8.1 so I could deploy the app. And if I switch right back to 2.8.2 it works again! Since changing the version of the plugin helps I've tried running Gradle with --refresh-dependencies but that doesn't make it work.

Since the error occurs inside JarAssetResolver, happens randomly and is helped by changing the dependencies, perhaps the bug is triggered by JARs being processed in a specific order? Also, the errors began a month or so after our first Windows developer started working on the project (Linux developers only before that) - probably unrelated, but who knows..

I'm assuming this is a Gradle issue so I'm posting the report to the pipeline core tracker, but can move to the Grails plugin one.

We're using Gradle 2.9, Java 8 and Grails 3.1.6

@davydotcom
Copy link
Contributor

Thats very weird the line number is just asking the jarFile for entries() and iterating. no more to that stack trace ?

@varju
Copy link

varju commented Nov 16, 2016

My team is seeing the same sporadic failure with asset-pipeline plugin 2.11.5 and Gradle 3.1. We also see one other random exception at the same line:

org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':foo:bar:assetCompile'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:46)
        at org.gradle.api.internal.tasks.execution.PostExecutionAnalysisTaskExecuter.execute(PostExecutionAnalysisTaskExecuter.java:35)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:64)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:53)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:233)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:215)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.processTask(AbstractTaskPlanExecutor.java:74)
        at org.gradle.execution.taskgraph.AbstractTaskPlanExecutor$TaskExecutorWorker.run(AbstractTaskPlanExecutor.java:55)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:54)
        at org.gradle.internal.concurrent.StoppableExecutorImpl$1.run(StoppableExecutorImpl.java:40)
Caused by: java.lang.NullPointerException
        at asset.pipeline.fs.JarAssetResolver.scanForFiles(JarAssetResolver.groovy:145)
        at asset.pipeline.fs.AssetResolver$scanForFiles.call(Unknown Source)
        at asset.pipeline.fs.AssetResolver$scanForFiles.call(Unknown Source)
        at asset.pipeline.AssetCompiler$_getAllAssets_closure6.doCall(AssetCompiler.groovy:340)
        at asset.pipeline.AssetCompiler.getAllAssets(AssetCompiler.groovy:339)
        at asset.pipeline.AssetCompiler.compile(AssetCompiler.groovy:121)
        at asset.pipeline.AssetCompiler$compile.call(Unknown Source)
        at asset.pipeline.gradle.AssetCompile.compile(AssetCompile.groovy:221)
        at org.gradle.internal.reflect.JavaMethod.invoke(JavaMethod.java:75)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.doExecute(DefaultTaskClassInfoStore.java:136)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:129)
        at org.gradle.api.internal.project.taskfactory.DefaultTaskClassInfoStore$StandardTaskAction.execute(DefaultTaskClassInfoStore.java:118)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:623)
        at org.gradle.api.internal.AbstractTask$TaskActionWrapper.execute(AbstractTask.java:606)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:80)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:61)
        ... 14 more

When this happens to us, gradle assetCompile on its own will typically fix the problem.

In our case we have a fairly large multi-project build, with one child project which makes use of the asset-pipeline plugin; this one child project depends on a number of upstream projects.

I haven't actually been able to reproduce the failure myself, but one potential cause I've been speculating about is changes to upstream project jar files in parallel to the assetCompile task execution. I've tried to deliberately introduce this type of change while the build was executing, though, and everything kept working. It seems like all the task dependencies are registered properly, so this might be a false lead.

I'll be upgrading to 2.11.6 next, but I don't really think this will help us since we've only got a single subproject that uses this plugin.

@neilabdev
Copy link

+1

@davydotcom
Copy link
Contributor

this may be resolved in 2.12.x

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants