CLI assumptions about server-side I/O


(Eron Wright) #1

The stardog data add command seems to take the assumption that if the connection is to localhost, then it may use server-side file I/O (--server-side). This assumption may be false in containerization scenarios, e.g. when running Stardog using Docker Desktop, or when accessing a remote Stardog via an SSH proxy (e.g. kubectl port-forward).

In the below example, I am connecting to a remote Stardog server using SSH local port forwarding. The error one sees in this scenario is:

stardog data add http://localhost:5820/mydatabase myfile.ttl 
Adding data from file: myfile.ttl
An error occurred adding RDF to the index: /Users/eron/myproject/myfile.ttl

On the server, the error message indicates that the CLI attempted to use server-side I/O:

ERROR 2018-08-05 18:29:10,709 [stardog-user-2] com.stardog.http.server.undertow.ErrorHandling:writeError(138): Unexpected error on the server
com.complexible.stardog.db.DatabaseException: An error occurred adding RDF to the index: /Users/eron/myproject/myfile.ttl
...
Caused by: java.nio.file.NoSuchFileException: /Users/eron/myproject/myfile.ttl
...

The only workaround that I have found is to use an alias for localhost in /etc/hosts, e.g. mystardog. This reveals that the CLI varies its behavior based on the connection URI. May I suggest that the CLI not make the assumption of server-side I/O when presented with an absolute URI?

Thanks!