Skip to content
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

[SERVER - ERROR] Client closed the connection #2

Open
dtraboulsi24 opened this issue Aug 31, 2016 · 3 comments
Open

[SERVER - ERROR] Client closed the connection #2

dtraboulsi24 opened this issue Aug 31, 2016 · 3 comments

Comments

@dtraboulsi24
Copy link

Hello,

When trying to send any other commands from the controller while interacting with the one of the clients I get this error:
[SERVER - ERROR] Client closed the connection
[INFO] Retreiving connections again...

The only commands that work successfully are the ones that are the "CD" and "quit" commands listed before the else statement here:

else:
allConnections[chosenone].send(data)
msg = allConnections[chosenone].recv(20480)
sendController(msg, q)
if (sendController(msg, q) == 0):
breakit = True
break
I have narrowed the error to its origin somewhere in that block of code, but I cannot find anything wrong with this code.

I am running the client, server, and controller from separate Windows machines. If someone could please help me out that would be great. Thanks!

@dtraboulsi24
Copy link
Author

Upon further investigation the client is closing causing the controller to break. the line of code that is causing this issue is the "signal.signal(signal.SIGALRM, alarm_handler)" line in this block.

thecommand = ' '.join(commands)
comm = subprocess.Popen(thecommand, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
stdin=subprocess.PIPE)
signal.signal(signal.SIGALRM, alarm_handler)
signal.alarm(30)
try:
STDOUT, STDERR = comm.communicate()
en_STDERR = bytearray(STDERR)
en_STDOUT = bytearray(STDOUT)
if (en_STDERR == ""):
if (en_STDOUT != ""):
print en_STDOUT
s.send(en_STDOUT)
else:
s.send("[CLIENT] Command Executed")
else:
print en_STDERR
s.send(en_STDERR)

@sayak-brm
Copy link

Quoting from https://support.sas.com/documentation/onlinedoc/sasc/doc750/html/lr1/zsigalrm.htm:

By default, SIGALRM causes the program to abnormally terminate with a user ABEND code of 1225.

@sayak-brm
Copy link

Well, it seems that the above has nothing to do with this error.

@dtraboulsi24 Are you on Windows?

Because in Windows, the SIGALRM attribute is not present in the signal module.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants