cf-maven-plugin throws ReadBufferOverflowException getting recent logs

85 views
Skip to first unread message

mama...@gmail.com

unread,
Aug 15, 2014, 3:58:34 PM8/15/14
to vcap...@cloudfoundry.org
Hi everyone,

I've used cf-maven-plugin to successfully push an app. Now I'm trying to use the recentLogs goal to get the logs. My POM looks like this:

<plugin>
 
<groupId>org.cloudfoundry</groupId>
 
<artifactId>cf-maven-plugin</artifactId>
 
<version>1.0.4</version>
 
<configuration> ... </configuration>
 
<executions>
   
<!-- Deploy the app. -->
   
<execution>
     
<id>deploy-test-app</id>
     
<phase>process-test-resources</phase>
     
<goals>
       
<goal>push-only</goal>
     
</goals>
   
</execution>

   
<!-- Then, fetch the logs. -->
   
<execution>
     
<id>grab-logs</id>
     
<phase>test-compile</phase>
     
<goals>
       
<goal>recentLogs</goal>
     
</goals>
   
</execution>
 
</executions>
</plugin>

The push goal works fine, but recentLogs always fails with this error:

[INFO] --- cf-maven-plugin:1.0.4:recentLogs (grab-logs) @ org.eclipse.orion.client.releng ---
[INFO] Getting logs for 'orion-test'
[INFO]
[ERROR] Failed to execute goal org.cloudfoundry:cf-maven-plugin:1.0.4:recentLogs (grab-logs) on project org.eclipse.orion.client.releng: An exception was caught while executing Mojo. javax.websocket.DeploymentException: The HTTP request to initiate the WebSocket connection failed: org.apache.tomcat.websocket.ReadBufferOverflowException -> [Help 1]
org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal org.cloudfoundry:cf-maven-plugin:1.0.4:recentLogs (grab-logs) on project org.eclipse.orion.client.releng: An exception was caught while executing Mojo.
        ...
Caused by: org.cloudfoundry.client.lib.CloudOperationException: javax.websocket.DeploymentException: The HTTP request to initiate the WebSocket connection failed
        at org.cloudfoundry.client.lib.rest.LoggregatorClient.connectToLoggregator(LoggregatorClient.java:45)
        at org.cloudfoundry.client.lib.rest.CloudControllerClientImpl.streamLoggregatorLogs(CloudControllerClientImpl.java:1955)
        at org.cloudfoundry.client.lib.rest.CloudControllerClientImpl.getRecentLogs(CloudControllerClientImpl.java:228)
        at org.cloudfoundry.client.lib.CloudFoundryClient.getRecentLogs(CloudFoundryClient.java:347)
        at org.cloudfoundry.maven.RecentLogs.doExecute(RecentLogs.java:48)
        at org.cloudfoundry.maven.AbstractCloudFoundryMojo.execute(AbstractCloudFoundryMojo.java:274)
        ... 21 more
Caused by: javax.websocket.DeploymentException: The HTTP request to initiate the WebSocket connection failed
        at org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:315)
        at org.cloudfoundry.client.lib.rest.LoggregatorClient.connectToLoggregator(LoggregatorClient.java:42)
        ... 26 more
Caused by: java.util.concurrent.ExecutionException: org.apache.tomcat.websocket.ReadBufferOverflowException
        at org.apache.tomcat.websocket.AsyncChannelWrapperSecure$WrapperFuture.get(AsyncChannelWrapperSecure.java:508)
        at org.apache.tomcat.websocket.WsWebSocketContainer.processResponse(WsWebSocketContainer.java:542)
        at org.apache.tomcat.websocket.WsWebSocketContainer.connectToServer(WsWebSocketContainer.java:296)
        ... 27 more
Caused by: org.apache.tomcat.websocket.ReadBufferOverflowException
        at org.apache.tomcat.websocket.AsyncChannelWrapperSecure$ReadTask.run(AsyncChannelWrapperSecure.java:305)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1176)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:641)
        at java.lang.Thread.run(Thread.java:853)

I know the app is running, and I can see the logs using `cf logs --recent` from a command shell. I just can't get them from cf-maven-plugin.

Some googling suggested that the error might be from the underlying Tomcat websocket connection timing out too early. I tried to disable the timeout by configuring the tomcat-embed-websocket plugin that cf-maven-plugin is using internally, but this had no effect:

<plugins>
 
<plugin>
   
<groupId>org.apache.tomcat.embed</groupId>
   
<artifactId>tomcat-embed-websocket</artifactId>
   
<version>8.0.5</version>
   
<configuration>
     
<org.apache.tomcat.websocket.BLOCKING_SEND_TIMEOUT>-1</org.apache.tomcat.websocket.BLOCKING_SEND_TIMEOUT> <!-- -1 means no timeout -->
   
</configuration>
 
</plugin>
  ...
</plugins>

Anyone have ideas?

James Bayer

unread,
Aug 16, 2014, 8:56:41 AM8/16/14
to vcap...@cloudfoundry.org
one idea: if you're on run.pivotal.io then you need to connect to alternative port 4443 to get websocket support.

there are several support tickets that discuss this such as [1]. if you are in fact running on run.pivotal.io and still having issues, please open a support case at support.pivotal.io if you find that doesn't fix your problem.




--
You received this message because you are subscribed to the Google Groups "Cloud Foundry Developers" group.
To view this discussion on the web visit https://groups.google.com/a/cloudfoundry.org/d/msgid/vcap-dev/d6221509-ed2e-4423-908a-8d9819722970%40cloudfoundry.org.

To unsubscribe from this group and stop receiving emails from it, send an email to vcap-dev+u...@cloudfoundry.org.



--
Thank you,

James Bayer

Scott Frederick

unread,
Aug 19, 2014, 3:52:16 PM8/19/14
to vcap...@cloudfoundry.org
The cf-java-client used by the Maven plugin queries the "logging_endpoint" attribute from the "/v2/info" endpoint to find the loggregator endpoint, so it should be getting the right host and port. 

Is there a proxy or any other network complications between your client machine and CF?

Scott
To unsubscribe from this group and stop receiving emails from it, send an email to vcap-dev+unsubscribe@cloudfoundry.org.

Mark Macdonald

unread,
Aug 21, 2014, 11:00:22 AM8/21/14
to vcap...@cloudfoundry.org

No proxy. Although I am behind NAT, it usually doesn't cause any issues.


I'm targeting api.ng.bluemix.net, not run.pivotal.io. I will try running the Maven plugin against run.pivotal.io instead, which should at least tell me if this is a general problem with my network, or something specific to the endpoint. Thanks James and Scott.

Mark

mama...@gmail.com

unread,
Oct 22, 2014, 4:05:53 PM10/22/14
to vcap...@cloudfoundry.org, mama...@gmail.com
For the benefit of anyone reading this thread: my original problem was caused by a bug in the underlying Tomcat websocket library used by the cf-java-client (and therefore cf-maven-plugin). The bug is described here: https://issues.apache.org/bugzilla/show_bug.cgi?id=57054.

The fabric I was using at api.ng.bluemix.net happened to trigger this bug, while run.pivotal.io did not.

Scott Frederick

unread,
Oct 22, 2014, 5:30:51 PM10/22/14
to vcap...@cloudfoundry.org, mama...@gmail.com
There is an issue in the cf-java-client GitHub repo to update to a version of the Tomcat websockets library that includes a fix for this issue once it is released: https://github.com/cloudfoundry/cf-java-client/issues/221
Reply all
Reply to author
Forward
0 new messages