-
Notifications
You must be signed in to change notification settings - Fork 145
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
getting wierd error after client disconnects (winScp) #138
Comments
here are some debug logs..
|
You should be able to handle these by adding an |
On the sftpStream object, Session object or client object ? Also assuming ill handle and swallow the error, and manage to keep the server running.. any idea as to why this could happen ? |
The Client object. As to why it's happening, it's hard to say. Is your server terminating the connection or is the client? If it's the latter, then there's not much that can be done since it is disconnecting seemingly abruptly. |
So error event does not get caught when i subscribe to on 'error' export class SftpSessionHandler {
private Logger: log4js.Logger;
private IngestProfileDirectories: InMemoryDirectoryList;
private ProfileDirectories: InMemoryDirectory[];
private KalturaClient: KalturaClientWrapper;
constructor(private authenticatedUser: AuthenticatedUser, private sftpStream: SFTPStream, ) {
this.Logger = ServiceFactory.GetLogger("SftpApiProxyServer");
this.KalturaClient = ServiceFactory.GetKalturaClient();
this.sftpStream.on('REALPATH', async (reqId, path) => await this.onRealPath(reqId, path).catch((reason) => this.handleSftpError(reqId, reason)));
this.sftpStream.on('SETSTAT', async (reqId, path, attrs) => await this.onSetStat(reqId, path, attrs).catch((reason) => this.handleSftpError(reqId, reason)));
this.sftpStream.on('OPENDIR', async (reqId, path) => await this.OpenDir(reqId, path).catch((reason) => this.handleSftpError(reqId, reason)));
this.sftpStream.on('READDIR', async (reqId, handle) => await this.onReadDir(reqId, handle).catch((reason) => this.handleSftpError(reqId, reason)));
this.sftpStream.on('LSTAT', async (reqId, path) => await this.onLStat(reqId, path).catch((reason) => this.handleSftpError(reqId, reason)));
this.sftpStream.on('OPEN', async (reqId, filename, flags, attrs) => await this.onOpen(reqId, filename, flags, attrs).catch((reason) => this.handleSftpError(reqId, reason)));
this.sftpStream.on('WRITE', async (reqId, handle, offset, data) => await this.onWrite(reqId, handle, offset, data).catch((reason) => this.handleSftpError(reqId, reason)));
this.sftpStream.on('REMOVE', async (reqId, path) => await this.onRemove(reqId, path).catch((reason) => this.handleSftpError(reqId, reason)));
this.sftpStream.on('RENAME', async (reqId, oldPath, newPath) => await this.onRename(reqId, oldPath, newPath).catch((reason) => this.handleSftpError(reqId, reason)));
this.sftpStream.on('CLOSE', async (reqId, handle) => await this.onClose(reqId, handle).catch((reason) => this.handleSftpError(reqId, reason)));
this.sftpStream.on('FSETSTAT', async (reqId, handle) => await this.onFsetStat(reqId, handle).catch((reason) => this.handleSftpError(reqId, reason)));
this.sftpStream.on('READ', async (reqId, handle, offset, length) => await this.onRead(reqId, handle, offset, length).catch((reason) => this.handleSftpError(reqId, reason)));
this.sftpStream.on('STAT', async (reqId, path) => await this.onStat(reqId, path).catch((reason) => this.handleSftpError(reqId, reason)));
this.sftpStream.on('close', async ()=> this.onDisconnectOrError(null));
this.sftpStream.on('end', async ()=> this.onDisconnectOrError(null));
this.sftpStream.on('error', async (err)=> this.onDisconnectOrError(err));
}
....
public async onDisconnectOrError(err:any) {
this.Logger.debug(`DISCONNECT OR ERROR user:[${this.authenticatedUser.username}]`);
this.Logger.error('ERROR:',err);
this.sftpStream.end();
} I don't see the log message .. |
well workaround works by attaching to
|
all goes well until a client discinnects .. this is when the server crashes ..
and i cant find the reason :\
The text was updated successfully, but these errors were encountered: