Borrar filtros
Borrar filtros

System call bizarre behavior

9 visualizaciones (últimos 30 días)
Paul Bennetto
Paul Bennetto el 6 de Oct. de 2017
Editada: Max Rudolph el 2 de Mayo de 2018
I have a problem running Matlab 2017a on Centos 7. System/Unix calls will occasionally fail the first time they are called. The error received is "bang: poll [4] interrupted system call". The following call will then return the results of the proceeding call.
>> system('echo dogbone')
Error using system
Unexpected system error: bang: poll [4] Interrupted system call
>> system('echo dogbone1');
dogbone
>> system('echo dogbone2');
dogbone1
>> system('echo dogbone3');
dogbone2
I have never seen anything like this, and it's very frustrating. It only appears occasionally, but I can replicate it consistently by ssh-ing from another machine, like so:
ssh -X user@machine 'matlab -nodesktop'
Any Thoughts?

Respuestas (5)

Michael Pelletier
Michael Pelletier el 19 de Feb. de 2018
Editada: Michael Pelletier el 19 de Feb. de 2018
I found the root cause of this via an strace of the MATLAB process. It revealed this tidbit shortly after the attempt to run the first system() invocation:
553435 ioctl(3, SNDRV_TIMER_IOCTL_SELECT or TIOCSPGRP, [553435]) = -1 ENOTTY (Inappropriate ioctl for device)
The "ENOTTY" means that the ioctl() call is inapplicable because the session is not associated with a pseudo-tty. And the reason that a poll() error comes back is because the thread reporting the error is not the one actually doing the fork/exec - it just sent a message to the thread that does. And so when the fork/exec thread fails, the poll() waiting for the response from that thread is interrupted.
The fix is to use the "-t" option for SSH, that is:
ssh -t -X user@machine 'matlab -nodesktop'
This forces the SSH server to allocate a pseudo-tty to the MATLAB process' environment whether it thinks it needs it or not, and so the ENOTTY error is avoided, and so allows the first system() call, and all subsequent system() calls, to work as expected.

Sharath Chandran
Sharath Chandran el 13 de Oct. de 2017
Editada: Sharath Chandran el 13 de Oct. de 2017
Hi Paul,
Could you please try sourcing .bash_profile prior to calling MATLAB?
If you are trying to launch MATLAB remotely on a different machine, then I would suggest you to try following:
$ ssh -l user@remoteSystem /bin/bash -c "matlab -nodisplay -nodesktop -noFigureWindows -r testScript.m"
where 'testScript.m' contains the command : system('echo dogbone'). Probably specifying the shell name, like above, works (since it reads .bash_profile while logging in using bash shell).
The difference probably is whether bash is in login mode or interactive mode (when .bash_profile is read) when invoking MATLAB in remote workflow.
I hope this helps.
Regards,
MathWorks Technical Support
  1 comentario
Michael Pelletier
Michael Pelletier el 9 de En. de 2018
What information or service is MATLAB looking to obtain from the shell? Are there environment variables it's looking for, etc? This seems to be a change of behavior from prior releases - we've been running tens of thousands of MATLAB distributed compute jobs in a compute cluster without a shell for years.

Iniciar sesión para comentar.


Jordan
Jordan el 26 de Nov. de 2017
I obtain this same behaviour when I launch matlab and make system() calls within a VNC session, then ssh into my server from a different machine to check on how my system() job is going in the VNC session. Doing so causes an error in whatever job was running in the interactive matlab shell.
"Unexpected system error: bang: poll [4] Interrupted system call"
...followed by the same bizarre behaviour reported above. I am running Matlab 2017a on Ubuntu 16.04.3.

Michael Pelletier
Michael Pelletier el 13 de Feb. de 2018
This problem also plagues my code to submit HTCondor jobs from Windows machines, because it uses SSH to reach a machine where it can run condor_submit, if HTCondor is not installed on the Windows machine. If there's no answer to this, looks like I may be forced to do a try/catch along with a dummy second call to get any results, such as the job ID number.

Max Rudolph
Max Rudolph el 2 de Mayo de 2018
Editada: Max Rudolph el 2 de Mayo de 2018
I am having this problem as well, and it renders MATLAB essentially useless for common tasks that require me to invoke an external program. I also have R2017a on Ubuntu 18 LTS. I have additional, even more bizarre behavior. Sometimes MATLAB cannot find files in the cwd the first time, but they appear by running 'ls' twice: >> ls geoid.ab >> ls geoid.ab geoid.ab
>>

Categorías

Más información sobre Startup and Shutdown en Help Center y File Exchange.

Etiquetas

Productos

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by