question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

StatsDOutputWriter - Given data too big for the buffer size

See original GitHub issue

jmxtrans-agent-1.2.4.jar StatsDOutputWriter is indefinitelly failing with “java.nio.BufferOverflowException”. It seems error was triggered by random failed DNS resolution, that caused some buffer (lim=91) to fill up.

2017-03-07 03:19:29.614 SEVERE [jmxtrans-agent-1] org.jmxtrans.agent.StatsDOutputWriter - Could not send stat java.nio.HeapByteBuffer[pos=0 lim=91 cap=1024] to host telegraf:8125
java.io.IOException: Target address not resolved
        at sun.nio.ch.DatagramChannelImpl.send(DatagramChannelImpl.java:425)
        at org.jmxtrans.agent.StatsDOutputWriter.flush(StatsDOutputWriter.java:157)
        at org.jmxtrans.agent.StatsDOutputWriter.doSend(StatsDOutputWriter.java:128)
        at org.jmxtrans.agent.StatsDOutputWriter.writeQueryResult(StatsDOutputWriter.java:118)
        at org.jmxtrans.agent.OutputWriterCircuitBreakerDecorator.writeQueryResult(OutputWriterCircuitBreakerDecorator.java:90)
        at org.jmxtrans.agent.Query.processAttributeValue(Query.java:274)
        at org.jmxtrans.agent.Query.collectAndExportAttribute(Query.java:239)
        at org.jmxtrans.agent.Query.collectAndExportForObjectName(Query.java:173)
        at org.jmxtrans.agent.Query.collectAndExport(Query.java:167)
        at org.jmxtrans.agent.TimeTrackingCollector.collectIfEnoughTimeHasPassed(TimeTrackingCollector.java:54)
        at org.jmxtrans.agent.JmxTransExporter.collectAndExport(JmxTransExporter.java:209)
        at org.jmxtrans.agent.JmxTransExporter$2.run(JmxTransExporter.java:131)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)

2017-03-07 03:19:29.614 WARNING [jmxtrans-agent-1] org.jmxtrans.agent.StatsDOutputWriter - Given data too big (98bytes) for the buffer size (91bytes), skip it: jmxtransagents.xx...

2017-03-07 03:19:29.615 WARNING [jmxtrans-agent-1] org.jmxtrans.agent.Query - Exception collecting java.lang:type=OperatingSystem#MaxFileDescriptorCount
java.nio.BufferOverflowException
        at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:183)
        at java.nio.ByteBuffer.put(ByteBuffer.java:832)
        at org.jmxtrans.agent.StatsDOutputWriter.doSend(StatsDOutputWriter.java:136)
        at org.jmxtrans.agent.StatsDOutputWriter.writeQueryResult(StatsDOutputWriter.java:118)
        at org.jmxtrans.agent.OutputWriterCircuitBreakerDecorator.writeQueryResult(OutputWriterCircuitBreakerDecorator.java:90)
        at org.jmxtrans.agent.Query.processAttributeValue(Query.java:274)
        at org.jmxtrans.agent.Query.collectAndExportAttribute(Query.java:239)
        at org.jmxtrans.agent.Query.collectAndExportForObjectName(Query.java:173)
        at org.jmxtrans.agent.Query.collectAndExport(Query.java:167)
        at org.jmxtrans.agent.TimeTrackingCollector.collectIfEnoughTimeHasPassed(TimeTrackingCollector.java:54)
        at org.jmxtrans.agent.JmxTransExporter.collectAndExport(JmxTransExporter.java:209)
        at org.jmxtrans.agent.JmxTransExporter$2.run(JmxTransExporter.java:131)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)

...

2017-03-07 08:26:33.896 WARNING [jmxtrans-agent-1] org.jmxtrans.agent.StatsDOutputWriter - Given data too big (104bytes) for the buffer size (91bytes), skip it: jmxtransagents.xx...

2017-03-07 08:26:33.896 WARNING [jmxtrans-agent-1] org.jmxtrans.agent.Query - Exception collecting java.lang:type=OperatingSystem#SystemCpuLoad
java.nio.BufferOverflowException
        at java.nio.HeapByteBuffer.put(HeapByteBuffer.java:183)
        at java.nio.ByteBuffer.put(ByteBuffer.java:832)
        at org.jmxtrans.agent.StatsDOutputWriter.doSend(StatsDOutputWriter.java:136)
        at org.jmxtrans.agent.StatsDOutputWriter.writeQueryResult(StatsDOutputWriter.java:118)
        at org.jmxtrans.agent.OutputWriterCircuitBreakerDecorator.writeQueryResult(OutputWriterCircuitBreakerDecorator.java:90)
        at org.jmxtrans.agent.Query.processAttributeValue(Query.java:274)
        at org.jmxtrans.agent.Query.collectAndExportAttribute(Query.java:239)
        at org.jmxtrans.agent.Query.collectAndExportForObjectName(Query.java:173)
        at org.jmxtrans.agent.Query.collectAndExport(Query.java:167)
        at org.jmxtrans.agent.TimeTrackingCollector.collectIfEnoughTimeHasPassed(TimeTrackingCollector.java:54)
        at org.jmxtrans.agent.JmxTransExporter.collectAndExport(JmxTransExporter.java:209)
        at org.jmxtrans.agent.JmxTransExporter$2.run(JmxTransExporter.java:131)
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
        at java.util.concurrent.FutureTask$Sync.innerRunAndReset(FutureTask.java:351)
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:178)
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
        at java.lang.Thread.run(Thread.java:722)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
cyrille-leclerccommented, Sep 18, 2017

Released in 1.2.6

0reactions
foyglcommented, Sep 1, 2017

@cyrille-leclerc Are there plans for making an official release with this fix in it? We are seeing this issue a lot and it would be good to have an official release rather than us relying on a random snapshot build. This has been really useful for us, so keep up the good work! 🥇

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to set the buffer size on a BufferedWriter over a FileWriter
Trying to open already opened file. · Lines might be cut and mixed. · No flushing and closing buffers will mean (the tail...
Read more >
StatsDOutputWriter.java example - Javatips.net
This class describes the usage of StatsDOutputWriter.java. ... 1)) { logger.warning("Given data too big (" + data.length + "bytes) for the buffer size...
Read more >
15.3. Large Data Rates — Fast DDS 2.9.0 documentation
The solution is to increase the buffers size. It is also possible to limit the rate at which the Publisher sends data using...
Read more >
CWE-131: Incorrect Calculation of Buffer Size (4.9) - MITRE
The software does not correctly calculate the size to be used when ... Executing the above code could result in a buffer overflow...
Read more >
Determining the max allowable buffer size - Oracle Communities
I'd like to design it in a way so that I could allocate as big of a memory buffer as I can, read...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found