CobaltFusion / DebugViewPP

DebugView++, collects, views, filters your application logs, and highlights information that is important to you!
Boost Software License 1.0
978 stars 144 forks source link

Solve related to UDP use cases #361

Closed janwilmans closed 4 years ago

janwilmans commented 4 years ago

@marknelson reports:

Okay, I'm able to characterize the UDP problems pretty well - figuring it out proved interesting.

As it turns out, I was sending trace from a C++ program, and I was inadvertently including the null terminator in my UDP packet.

If you run this python script, sending 100K lines at full speed across the local network, DebugView++ reliably captures all packets.

However, if you uncomment the line that appends a null terminate, you'll see some crazy erratic behavior. It's almost like the lines are capture properly, but the rendering is going nuts.

Try this out, with and without the null terminator. This might work just as well if all the traffic is going through localhost, but I was going across the network:

from __future__ import print_function
import ctypes
import socket
import sys

sock = socket.socket(socket.AF_INET, # Internet
                     socket.SOCK_DGRAM) # UDP

for i in range(100000):
  msg = "Hello, world {0}, testing 012345678901234567890123456789".format(i)
  #msg = msg + chr(0)
  sock.sendto(msg, ("10.57.42.250", 9000))
#
janwilmans commented 4 years ago

I've created this issue for myself to solve :) With cppcon coming up I'm not sure I'll make it this week, but surely it should be solved soon.

janwilmans commented 4 years ago

@marknelson can you send a screenshot of the erratic behavior you describe ? What I see with the + chr(0) enabled is: image

Without may or may not be what you wanted, but I'm not sure its wrong. I did notice that due to the unreliable nature of UDP at this rate, 5 out of 100.000 message are lost.

janwilmans commented 4 years ago

84f7638b1c78defafb83e38e15ce2507a6037a2a changes the handling of UDP messages so \0 is considered the end of the last message, any trailing bytes are ignored

janwilmans commented 4 years ago

Please try v1.8.0.86 to see if this fixed the issue