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

sefran3 crashes when using fdsnws-dataselect and web server does not respond #16

Open
XavierBeguin opened this issue Jul 9, 2019 · 4 comments

Comments

@XavierBeguin
Copy link
Collaborator

XavierBeguin commented Jul 9, 2019

The Sefran3 process crashes when doing a fdsnws-dataselect request while the remote web server providing the fdsnws service is not available.

This is the error from the stderr file :

WEBOBS{readdata}:  command unsuccessful [rc = 4]: chec: Connexion refuse.
Error in sefran3>readdata (line 597)
Error in sefran3 (line 205)

As one can see, this is due to the wget system call on line 597 of sefran3.m (in WebObs 2.1.2c) :
wosystem(sprintf('wget -nv -O %s "%s%s"',fmsdchan,datasource,wsreq),SEFRAN3);

I'm surprised that this wget error crashes the whole process. The expected behaviour would be to display an error message and continue with the realtime data plotting. A try/catch block would probably be useful here to catch the error without dying.

@beaudu
Copy link
Member

beaudu commented Jul 10, 2019

the command wosystem has the following behavior when the command fails:

  • without output argument, it crashes the process and displays and error, since we have considered that a failure is not normal;
  • adding a 'warning' option will display the error message and continue; this is probably what we want with wget commands and especially in that case;
  • with output arguments [status,result]=wosystem() the process will not crash since we suppose the outputs will be used to make later decisions.
    Other options are available for this command.

So for this particular issue, we have two solutions:
a. adds the 'warning' option so any error won't stop and the proc will just continue without the data;
b. adds output argument and make decision based on the rc code.

@XavierBeguin
Copy link
Collaborator Author

Thanks for the information about wosystem. I overlooked/forgot its behaviour. (Although, to be complete, from the information within wosystem.m, using the form [status,result]=wosystem() does not seem enough to prevent the error from being produced, one still have to add the 'warning' optional argument.)

Adding 'warning' to the wosystem call on line 597 of sefran3.m indeed does the trick, and the process does not die if the web server is not reachable (it worked as expected after recompilation):

- wosystem(sprintf('wget -nv -O %s "%s%s"',fmsdchan,datasource,wsreq),SEFRAN3);
+ wosystem(sprintf('wget -nv -O %s "%s%s"',fmsdchan,datasource,wsreq),SEFRAN3,'warning');

We could retain this behaviour, unless one prefers to add an option to choose between the two behaviour. My preference would be to always use with the 'warning' option as above, as the web server error is supposed to be temporary and detected by some external monitoring.

@XavierBeguin
Copy link
Collaborator Author

Oops, wrong button, I did not intend to close the issue ^^

@XavierBeguin XavierBeguin reopened this Jul 10, 2019
@XavierBeguin
Copy link
Collaborator Author

For the record, as François made me notice, my statement below is wrong, sorry for misreading the comments and not double checking the code. My bad...

(Although, to be complete, from the information within wosystem.m, using the form [status,result]=wosystem() does not seem enough to prevent the error from being produced, one still have to add the 'warning' optional argument.)

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