etch-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Michael Fitzner <fitzner.mich...@gmail.com>
Subject Re: Connection Timeout
Date Mon, 11 Feb 2013 22:59:28 GMT
The c-binding supports the @Timeout construct, but doesn‘t handle
blocking send calls (hangs while sending the request data to the
remote station) with it. If the request was sent out completely and
you haven‘t received any answer in the defined time period a timeout
should occur.

The @Timeout relates to the answer of a call.  So it is important to
differ between these two use cases:

1. Synchronous calls have a timeout to wait for the answers
2. Oneway calls have no answers, so you don‘t need to wait for it

In both scenarios it could happen that the TCP connection blocks
because the buffer runs out of space. If you have configured a send
timeout like „etch.tcpconnection.timeout.send“ it would be a good
approach to close the TCP connection internally and return an error
code to the caller.

Java code snipped:

		try
		{
			OutputStream os = checkOutputStream();
			os.write( buf, off, len );
			if (options.autoFlush)
				os.flush();
		}
		catch ( IOException e )
		{
			close( true );
			throw e;
		}
		catch ( RuntimeException e )
		{
			close( true );
			throw e;
		}

I would prefer a generic solution and doesn‘t handle possible send
errors by each call.

Regards
Michael


2013/2/11  <Harald.SC.Schmid@bmw.de>:
> Hi,
>
> unfortunately we are still using c-binding, which doesn't seem to support "@Timeout".
Attached you can find an attempt to address the issue (thanks to Martin Veith for some valuable
advise).
>
> Having the property "etch.tcpconnection.timeout.send" set, send-calls return after the
specified time interval and the result can be evaluated like in this example:
>
>     if (is_etch_exception(result))
>     {
>         UInt32 errorcode = etch_exception_get_errorcode((etch_exception*)result);
>         if (errorcode == ETCH_EIO)
>         {
>             remote_base->stop_waitdown(remote_base, 1000);
>         }
>     }
>
> What do you think?
>
> Thanks
> Harald
>
> -----Ursprüngliche Nachricht-----
> Von: scott comer [mailto:wert1y@mac.com]
> Gesendet: Freitag, 7. Dezember 2012 16:58
> An: etch-dev@incubator.apache.org
> Betreff: Re: Connection Timeout
>
> which binding(s) are you using?
>
> java and c# implement these:
>
> there's a way to allow the caller to only wait a certain amount of time
> for a response, which is @Timeout(n) marks on a method (or interface).
>
> this causes the caller to abandon the call but doesn't kill the connection.
>
> adding term filter=KeepAlive to a connection url will cause a hung
> connection to be detected and killed. it must be added to the urls of
> both client and server.
>
> for a connection to hang means that one of the message readers has hung
> or is just super busy. one way this can happen is for a message reader
> to make an etch call. you must take steps to prevent this from
> happening. one way is to mark the method as being as asynchronous (which
> causes it to be executed on a thread pool instead of by the reader).
>
> scott out
>
> On 12/7/2012 6:31 AM, Harald.SC.Schmid@bmw.de wrote:
>> Hi,
>>
>> currently we have the problem that the client sometimes doesn't read data of an etch
call for a long time. This blocks the calling server (in apr_socket_send()), in our case it
leads to a reset as the server fails to call the watchdog for that time.
>>
>> My question is: can I initialize an etch connection with a timeout for all etch calls?
>> Further, when the timeout gets reached, I want to be able to terminate the etch connection.
>> Is this already possible? If so, how does it work?
>>
>> Thanks,
>> Harald
>>
>>
>

Mime
View raw message