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

Improve error when connection initiation message is misformatted #9

Open
olexandr-konovalov opened this issue Feb 19, 2017 · 0 comments

Comments

@olexandr-konovalov
Copy link
Member

Python SCSCP server (https://github.com/OpenMath/py-scscp) produces incomplete connection initiation message, and this results in a very uninformative error message (after SetInfoLevel(InfoSCSCP,4):

gap> GetServiceDescription("localhost",26133);
#I  Creating a socket ...
#I  Connecting to a remote socket via TCP/IP ...
#I  Got connection initiation message
#I  <?scscp scscp_versions="1.3" ?>
Error, no method found! For debugging hints type ?Recovery from NoMethodFound
Error, no 1st choice method found for `+' on 2 arguments called from
PositionSublist( initmessage, "service_id=" ) 
+ 12 at /Users/alexk/gap4r8p6/pkg/scscp/lib/client.g:87 called from
StartSCSCPsession( tcpstream 
 ) at /Users/alexk/gap4r8p6/pkg/scscp/lib/process.gi:149 called from
NewProcess( arg[1], arg[2], arg[3], arg[4] 
 ) at /Users/alexk/gap4r8p6/pkg/scscp/lib/client.g:171 called from
EvaluateBySCSCP( "get_service_description", [  ], server, port 
 ) at /Users/alexk/gap4r8p6/pkg/scscp/lib/special.g:42 called from
<function "GetServiceDescription">( <arguments> )
 called from read-eval loop at line 3 of *stdin*
you can 'quit;' to quit to outer loop, or
you can 'return;' to continue
brk>

Indeed, page 11 of SCSCP 1.3 specification says:

"The format of the control sequence is compulsory, and server implementations must not change the order of the attribute/value pairs nor omit some of them. This strict
restriction makes it sure that even very simple clients should be able to parse this
control sequence."

This is an example of a properly formatted connection initiation message:

gap> GetServiceDescription("localhost",26134);
#I  Creating a socket ...
#I  Connecting to a remote socket via TCP/IP ...
#I  Got connection initiation message
#I  <?scscp service_name="GAP" service_version="4.8.6" service_id="localhost:26134:65854" scscp_versions="1.0 1.1 1.2 1.3" ?>
#I  Requesting version 1.3 from the server ...
#I  Server confirmed version 1.3 to the client ...
#I  Composing procedure_call message: 
<?scscp start ?>
<OMOBJ xmlns="http://www.openmath.org/OpenMath" version="2.0">
	<OMATTR>
		<OMATP>
			<OMS cd="scscp1" name="call_id"/>
			<OMSTR>localhost:26134:65854:LHqIqYO1</OMSTR>
			<OMS cd="scscp1" name="option_return_object"/>
			<OMSTR></OMSTR>
		</OMATP>
		<OMA>
			<OMS cd="scscp1" name="procedure_call"/>
			<OMA>
				<OMS cd="scscp2" name="get_service_description"/>
			</OMA>
		</OMA>
	</OMATTR>
</OMOBJ>
<?scscp end ?>

Upon reading connection initiation message, GAP should catch the case when PositionSublist returns fail and produce a meaningful error message instead of trying to add fail and an integer.

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

1 participant