Lisp IDE Portacle tells me "lisp connection closed unexpectedly connection broken by remote peer" - connection

So every time I try to run a code, it first gives me that message and then just "Not connected". How can I fix this?
There is a very similar question Getting started with SLIME and SWANK: Lisp connection closed unexpectedly: connection broken by remote peer but I'm using Portacle and as far as I know it should take care of stuff like slime.

Related

What does this UWSGI error mean? " SIGPIPE: writing to a closed pipe/socket/fd "

There are a few questions related to this issue, but none of them actually help me understand what is going on.
The full error:
SIGPIPE: writing to a closed pipe/socket/fd (probably the client disconnected) on request
It simply means that the client, i.e. the sites visitors, closed their connection.
Either by closing the browser, or through a connection error on their part.

Undefined TIdFTP status after error 10038 “Socket operation on non-socket”

I use a TIdFTP control to connect to an FTP server. It seems that my FTP connection is terminated by something (ftp server/firewall?) after 60 seconds of inactivity. Once the connection was terminated I cannot use the FTP control (TIdFTP) anymore because its status is undefined. For example, every time I try to REconnect I get the same (10038) error. However, FTP.Connected shows True. Trying FTP.Disconnect gives me a 'connection closed gracefully' error and the control remains connected. The only solution is to end the program and start it again.
The NAT Keep Alive is already set to 15000.
How to reset the status of the FTP control (how do I disconnect)?
I use a TIdFTP control to connect to an FTP server. It seems that my FTP connection is terminated by something (ftp server/firewall?) after 60 seconds of inactivity
TIdFTP has a NATKeepAlive property to avoid that exact issue from happening when connected through an FTP-unaware router/firewall. During a transfer, TCP keepalives are temporarily enabled on the control connection so it does not get closed prematurely.
However, FTP.Connected shows True.
That means the IOHandler.InputBuffer likely has unread data in it. Connected() is designed to return True if read operations can still be satisfied even if the socket has been closed.
Trying FTP.Disconnect gives me a 'connection closed gracefully' error
By default, Disconnect() sends a QUIT command to the server before closing the socket. Since the connection is already gone, that send fails.
Disconnect() has an optional ANotifyPeer parameter that you can set to False to skip the QUIT command.
You should also Clear() the IOHandler.InputBuffer after an unexpected disconnect to clear out any unread data.
The only solution is to end the program and start it again.
That is never the solution. Worse case, you could simply destroy the TIdFTP object and create a new one. But if you follow the steps above, you should not need to resort to even that.
You cannot keep TIdFTP open. The connection will be closed from server side for every timed out time.
As you use this component to fetch or put file to file server for a time interval, You can connect just before using the TIDFTP, and disconnect it after the usage. Then you do not need to bother about freeing the component and connection failures.

TCP/IP long-term connections

I have a server application which runs on a Linux machine. I can connect this application from Windows/Linux machines and can send/recieve data. After a few hours, something occurs and I get following error on the client side.
On Windows: An existing connection was forcibly closed by the remote host
On Linux: Connection timed out
I have made a search on the web and found some posts which suggest to increase/decrease OS's keep alive time. However, it didin't work for me.
Can I found a soultion to this problem or should I simply try to reconnect to the server when the connection is forcibly closed?
EDIT: I have tracked the situation. I sent a data to the remote node and sent another data after waiting 5 hours. Sending side sent the first data, but whet the sender sent the second data it didn't response. TCP/IP stack of the sender repeated this 5 times by incrementing the times between retries. Finally, sender reset the connection. I can't be sure why this is happening (Maybe because of a firewall or NAT - see Section 2.4) but I applied two different approach to solve this problem:
Use TCP/IP keep alive using setsockopt (Section 4.2)
Make an application level keep alive. This is more reliable since the first approach is OS related.
It depends on what your application is supposed to do. A little more information and perhaps the code you use for listening and handling connections could be of help.
Regardless, technically a longer keep alive time, should prevent the OS from cutting you off. So perhaps it is something else causing the trouble.
Such a thing could be router malfunction or traffic causing your keep-alive packet to get lost.
If you aren't already testing it on a LAN (without heavy trafic) I suggest doing so.
It might also be due to how your socket is handled (which I can't determine from your question)
This article might help.
Non blocking socket with timeout
I'm not used to how connections are handled on Linux, but I expect the OS won't cut off a connection unnecessary.
You can re-establish connection as a recovery, but you need to take into account that not all disconnects are gentle, and therefore you could end up making recovery on a connection you actually wish to be closed.
Since it is TCP, it will do its best to make a gentle disconnect, but you can send a custom message telling the server or client not to re-establish the connection right before disconnecting. That way you be absolutely sure, despite that it should be unnecessary to do so.

Keeping an opened connection TCP/IP

I am using TClientSocket and TServerSocket to comunicate with a server the problem is that sometimes connection is lost either by the server issuing me the following exceptions : Error on WsaSend, acess violation etc or by the Client : Asychronious socket error.
Witch is the best method to recover from these errors and keep the connection open no mather what ?
There is no such thing as "keeping the connection open no matter what". What if the cable gets cut? The best you can do is to send a heartbeat on some interval to let intermediate routers know you are still interested in using that connection, and to carefully handle all errors, and, if necessary, re-establish the connection.
Great question... what you're receiving is WSAECONNABORTED (Asynchronous Socket Error 10053).
How did i prevent it from happening in MY code ? well, there's something called Keepalive, if you look carefully into the name, Keep-Alive, it meant to keep the connection alive, just send Null data to the connection (Can be One-way), that's all...
i made a Timer (named it TmrKeepAlive) and set its interval to 5000ms (5 seconds), More info on KeepAlive.
Edit: Also, if you don't want to write your own KeepAlive mechanism, check this out

Delphi + Indy: Connection closed gracefully

Using D7 + Indy 10 latest build.
My code is using TIdSMTP to send email.
I keep getting "Connection closed gracefully" at some end-users, and the email is never sent.
The code is like:
try
~~~~
~~~~
_idSMTP := TIdSmtp.Create;
with _idSMTP do
begin
Host := 'myhost';
Connect;
try
Send(_EmailMsg);
Result := True;
except
on E: Exception do
begin
MsgDlgErr(Self.Handle, E.Message)
end
end;
end;
finally
_idSMTP.Disconnect;
_idSMTP.Free;
end;
Any advice?
Read all about it on http://www.swissdelphicenter.ch/en/showarticle.php?id=1
EIdConnClosedGracefully is an
exception signaling that the
connection has been closed by the
other side intentionally. This is not
the same as a broken connection which
would cause a connection reset error.
If the other side has closed the
connection and the socket is read or
written to, EIdConnClosedGracefully
will be raised by Indy. This is
similar to attempting to read or write
to a file that has been closed without
your knowledge.
In some cases this is a true exception
and your code needs to handle it. In
other cases (typically servers) this
is a normal part of the functioning of
the protocol and Indy handles this
exception for you. Even though Indy
catches it, when running in the IDE
the debugger will be triggered first.
You can simply press F9 to continue
and Indy will handle the exception,
but the constant stopping during
debugging can be quite annoying. In
the cases where Indy catches the
exception, your users will never see
an exception in your program unless it
is run from the IDE.
In my case the error was caused because I used a sender email address from a different domain than the one hosted by the smtp server, that's why the smtp server rejected the connection.
In my experience, in case of AT&T server, it rejects an email address which is not #att.net address in the MAIL FROM. More info can be determined by logging the error using TIdLogEvent for these users that receive it, otherwise the error report is rather vague - if the disconnect (Connection closed gracefully) occurs right after the MAIL FROM then it might indicate a server policy rejecting an email with the domain which it doesn't host as explained by Toni as well.
Otherwise the "Connection closed gracefully" error means that an attempt is being made to read/write to socket that has been closed by the peer intentionally - in your case, peer is the SMTP server you connect to. It is different than the "Connection reset" error which indicates a broken connection. In both cases, the connection is no longer present and you can't read/write anymore to it.
We got this error when the OpenSSL libraries hadn't been installed at the client site
I know it's old and so on, but i've done with this exeption already.
In my case, the server was blocking send of mail because I exceeded the daily send limits for the hosting service. It's easy to exceed these limits when testing something. The exception itself is ambiguous, so there may be more reasons, but I would start by checking this issue first. It solved the problem for me.

Resources