TCP target buffer overload

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

TCP target buffer overload

Francis1
Hi,

When sending a large string (68000 characters) to a TCP target I get this
exception.  I am using NLOG (.NET 2.0) v. 0.95 (I think, it shows 1.0.0 but
that can't right).

Error Target exception: System.Net.Sockets.SocketException: A message sent
on a datagram socket was larger than the internal message buffer or some
other network limit, or the buffer used to receive a datagram into was
smaller than the datagram itself
   at System.Net.Sockets.Socket.SendTo(Byte[] buffer, Int32 offset, Int32
size, SocketFlags socketFlags, EndPoint remoteEP)
   at System.Net.Sockets.Socket.SendTo(Byte[] buffer, EndPoint remoteEP)
   at NLog.Internal.NetworkSenders.UdpNetworkSender.DoSend(String text)
   at NLog.Internal.NetworkSenders.NetworkSender.Send(String text)
   at NLog.Targets.NetworkTarget.NetworkSend(String address, String text)
   at NLog.Targets.NLogViewerTarget.Write(LogEventInfo logEvent)
   at NLog.LoggerImpl.Write(Type loggerType, TargetWithFilterChain targets,
LogEventInfo logEvent)

Thanks,

Francis


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list
Reply | Threaded
Open this post in threaded view
|

Re: TCP target buffer overload

Jarek Kowalski
Administrator
Francis Gingras wrote:
> Hi,
>
> When sending a large string (68000 characters) to a TCP target I get this
> exception.  I am using NLOG (.NET 2.0) v. 0.95 (I think, it shows 1.0.0 but
> that can't right).
>  

That's the limitation of the protocol. UDP Cannot be used to send more
than 2^16 bytes in one packet. What should we do about it?
There are 3 options:

* quietly discard the message
* throw an error
* split the message into smaller pieces.

I propose the following attributes be added to the Network target:

maxChunkSize (default = 65000)
bufferOverflowAction=Discard|Error|Split

What do you think? If we are quick, I believe I can add them before 1.0
ships.

Jarek

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list
NLog Blog
Reply | Threaded
Open this post in threaded view
|

Re: TCP target buffer overload

Francis1
Jarek,

Ah right the protocol limitation, I didn't think of that.  What is the use
of discarding a message or throwing an error?  I would simply have the
target automatically split if size > 65000.

Of course what you propose is a nice feature but personally I don't see a
use for it.

Thanks for your amazingly fast response,

Francis

-----Original Message-----
From: Jaroslaw Kowalski [mailto:[hidden email]]
Sent: Friday, September 15, 2006 14:47
To: Francis Gingras
Cc: [hidden email]
Subject: Re: [Nlog-list] TCP target buffer overload

Francis Gingras wrote:
> Hi,
>
> When sending a large string (68000 characters) to a TCP target I get
> this exception.  I am using NLOG (.NET 2.0) v. 0.95 (I think, it shows
> 1.0.0 but that can't right).
>  

That's the limitation of the protocol. UDP Cannot be used to send more than
2^16 bytes in one packet. What should we do about it?
There are 3 options:

* quietly discard the message
* throw an error
* split the message into smaller pieces.

I propose the following attributes be added to the Network target:

maxChunkSize (default = 65000)
bufferOverflowAction=Discard|Error|Split

What do you think? If we are quick, I believe I can add them before 1.0
ships.

Jarek



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list
Reply | Threaded
Open this post in threaded view
|

Re: TCP target buffer overload

Jarek Kowalski
Administrator
Francis Gingras wrote:
Jarek,

Ah right the protocol limitation, I didn't think of that.  What is the use
of discarding a message or throwing an error?  I would simply have the
target automatically split if size > 65000.

Of course what you propose is a nice feature but personally I don't see a
use for it.
  
Assume you have a receiver that accepts XML-formatted messages and your message is 65010 bytes long and is

<message>............... ... </message>

If you split the message after 65000th byte, then neither part will be a well-formed XML, because the first will be "<message>............... ... " and the second one will be: "</message>". Dropping a such a packet might be a good idea. Throwing an error might give you a hint that some packets are actually dropped (you can use FallbackTarget to log to a file in case of an error).

Jarek

Thanks for your amazingly fast response,

Francis

-----Original Message-----
From: Jaroslaw Kowalski [[hidden email]] 
Sent: Friday, September 15, 2006 14:47
To: Francis Gingras
Cc: [hidden email]
Subject: Re: [Nlog-list] TCP target buffer overload

Francis Gingras wrote:
  
Hi,

When sending a large string (68000 characters) to a TCP target I get 
this exception.  I am using NLOG (.NET 2.0) v. 0.95 (I think, it shows 
1.0.0 but that can't right).
  
    

That's the limitation of the protocol. UDP Cannot be used to send more than
2^16 bytes in one packet. What should we do about it?
There are 3 options:

* quietly discard the message
* throw an error
* split the message into smaller pieces.

I propose the following attributes be added to the Network target:

maxChunkSize (default = 65000)
bufferOverflowAction=Discard|Error|Split

What do you think? If we are quick, I believe I can add them before 1.0
ships.

Jarek



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list

  


-- 
Jarek Kowalski
http://blog.jkowalski.net
http://www.nlog-project.org/ - A .NET Logging Library


-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list
NLog Blog
Reply | Threaded
Open this post in threaded view
|

Re: TCP target buffer overload

Jarek Kowalski
Administrator
In reply to this post by Jarek Kowalski
Jaroslaw Kowalski wrote:
> Francis Gingras wrote:
>  
>> Hi,
>>
>> When sending a large string (68000 characters) to a TCP target I get this
>> exception.  I am using NLOG (.NET 2.0) v. 0.95 (I think, it shows 1.0.0 but
>> that can't right).
>>    

The code is in SVN. Actual parameter names are different (onOverflow and
maxMessageSize). I'm just publishing a new snapshot.

Jarek

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
Nlog-list mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/nlog-list
NLog Blog