cbeust / kobalt

A Kotlin-based build system for the JVM.
Apache License 2.0
433 stars 60 forks source link

local file dependencies broken in 0.929 #326

Closed pabl0rg closed 7 years ago

pabl0rg commented 7 years ago

this can be reproduced with: https://github.com/pabl0rg/kobalt-mixed-example

I started kobalt server manually with ./kobaltw --force --server The following stacktrace was printed in the terminal and the IntelliJ plugin seemed stuck in an endless loop (burning CPU, never exiting, unable to cancel).

java.lang.IllegalArgumentException: Bad artifact coordinates file://./lib/jrobin-1.5.9.jar, expected format is <groupId>:<artifactId>[:<extension>[:<classifier>]]:<version>
    at org.eclipse.aether.artifact.DefaultArtifact.<init>(DefaultArtifact.java:77)
    at org.eclipse.aether.artifact.DefaultArtifact.<init>(DefaultArtifact.java:60)
    at com.beust.kobalt.maven.MavenId$Companion.createNoInterceptors(MavenId.kt:31)
    at com.beust.kobalt.maven.MavenId$Companion.create(MavenId.kt:43)
    at com.beust.kobalt.app.remote.RemoteDependencyData$dependenciesDataFor$5$1$1.invoke(RemoteDependencyData.kt:85)
    at com.beust.kobalt.app.remote.RemoteDependencyData$dependenciesDataFor$5$1.invoke(RemoteDependencyData.kt:98)
    at com.beust.kobalt.app.remote.RemoteDependencyData$dependenciesDataFor$5.invoke(RemoteDependencyData.kt:101)
    at com.beust.kobalt.app.remote.RemoteDependencyData.dependenciesDataFor(RemoteDependencyData.kt:144)
    at com.beust.kobalt.app.remote.GetDependencyGraphHandler.onWebSocketConnect(GetDependencyGraphHandler.kt:72)
    at org.eclipse.jetty.websocket.common.events.JettyListenerEventDriver.onConnect(JettyListenerEventDriver.java:106)
    at org.eclipse.jetty.websocket.common.events.AbstractEventDriver.openSession(AbstractEventDriver.java:229)
    at org.eclipse.jetty.websocket.common.WebSocketSession.open(WebSocketSession.java:497)
    at org.eclipse.jetty.websocket.common.WebSocketSession.onOpened(WebSocketSession.java:423)
    at org.eclipse.jetty.io.AbstractConnection.onOpen(AbstractConnection.java:192)
    at org.eclipse.jetty.websocket.common.io.AbstractWebSocketConnection.onOpen(AbstractWebSocketConnection.java:550)
    at org.eclipse.jetty.io.AbstractEndPoint.upgrade(AbstractEndPoint.java:197)
    at org.eclipse.jetty.server.HttpConnection.onCompleted(HttpConnection.java:366)
    at org.eclipse.jetty.server.HttpChannel.onCompleted(HttpChannel.java:611)
    at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:442)
    at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:242)
    at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:261)
    at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:95)
    at org.eclipse.jetty.io.SelectChannelEndPoint$2.run(SelectChannelEndPoint.java:75)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.produceAndRun(ExecuteProduceConsume.java:213)
    at org.eclipse.jetty.util.thread.strategy.ExecuteProduceConsume.run(ExecuteProduceConsume.java:147)
    at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:654)
    at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:572)
    at java.lang.Thread.run(Thread.java:745)
ON CLOSE 1005 reason: null
cbeust commented 7 years ago

Pinging @dmitry-zhuravlev

I found the issue on the Kobalt side, but @pabl0rg is right that the error causes the IDEA plug-in to go into a loop so there's also an issue on the plug-in side, which doesn't seem to handle errors correctly.

I traced this down into DependenciesProcessor on the following line (122):

            listener.onFailure(taskId, processorEx)

For some reason, calling this creates this loop. Any thoughts, Dmitry?

I was able to reproduce this easily with @pabl0rg's instructions, let me know if you need help.

cbeust commented 7 years ago

Fixed in 0.930.

@dmitry-zhuravlev Make sure you use 0.929 to reproduce this bug (leaving it open until I hear back from you).

dmitry-zhuravlev commented 7 years ago

@cbeust It seems that this error loop was caused by exception in method which try to determine line/column of Build.kt script. In this particular case the error message Bad artifact coordinates..... doesn't relates to Build.kt compilation and hence have no line/column inside.

cbeust commented 7 years ago

Ah yes, good catch. And yes, sync can fail for a lot of different reasons, not just a syntax error in the build file, so we need to make sure the parse can fail gracefully.