Unexpected 'Number of open connections' exception

0 views
Skip to first unread message

Rubén Navarro Piris

unread,
Dec 2, 2016, 11:06:37 AM12/2/16
to Stardog
Hi!

we're currently using the Stardog Community Edition (4.2) for some testing purposes and ran into a problem with too many open connections.

Some words about the setup:

* We've limited the number of concurrent connections to 5 in our application (Spring-based web app)
* We're also observing the number of TCP connections on the server running Stardog (which usually is about 600-1000, including waiting connections)

After a while our application crashes with the following exception: 

com.complexible.stardog.StardogException: 
Number of open connections exceeds the limit allowed by the license: 8096

My question is, whether Stardog deliberately crashes due to license violations or if this is unintended behavior. At the exact moment the exception gets thrown, the number of TCP connection on the Stardog server barely exceed 900, and the number of user connections was capped at 5. We're not quite sure where the 8096 is coming from.

We didn't encounter this error while using a commercial license.

Cheers!

Ruben

Stephen Nowell

unread,
Dec 2, 2016, 11:52:36 AM12/2/16
to sta...@clarkparsia.com
Hi Ruben,

Stardog in no way crashes deliberately; certainly not for community
license violations. This exception is just the server rejecting a new
connection because of the limit.

"Connection" here does not mean a TCP connection. It means a database
connection. Ensure that any connection your application creates is being
closed, or they will just pile up. The `stardog-admin server status`
command will display the number of open connections at any given time.
Note that open transactions also count towards this limit, as they
internally open a connection.

Cheers,
Stephen
> --
> -- --
> You received this message because you are subscribed to the C&P
> "Stardog" group.
> To post to this group, send email to sta...@clarkparsia.com
> To unsubscribe from this group, send email to
> stardog+u...@clarkparsia.com
> For more options, visit this group at
> http://groups.google.com/a/clarkparsia.com/group/stardog?hl=en

Rubén Navarro Piris

unread,
Dec 2, 2016, 1:07:35 PM12/2/16
to Stardog, ste...@stardog.com
HI Stephen!

We tried using the 'server-admin server status' command, but no information on the number of open connections is shown:

$ /opt/stardog/bin/stardog-admin server status --verbose
Backup Storage Directory : .backup
Connection Timeout       : 1h
Export Storage Directory : .exports
Named Graph Security     : true
Platform Arch            : amd64
Platform OS              : Linux 4.4.8-boot2docker, Java 1.8.0_91
Query All Graphs         : true
Query Timeout            : 5m
Stardog Home             : /opt/stardog-4.2
Stardog Version          : 4.2
Strict Parsing           : true

Stephen Nowell

unread,
Dec 2, 2016, 1:52:13 PM12/2/16
to Rubén Navarro Piris, Stardog
Hi Ruben,

I forgot that `stardog-admin server status` is different for the Community version and doesn't provide that information. It is still likely that the culprit is Connections or transactions not being closed/committed. Which API are you using in your application to connect to Stardog?

Cheers,
Stephen

Rubén Navarro Piris

unread,
Dec 5, 2016, 7:19:07 AM12/5/16
to Stardog, ruben.nav...@gmail.com, ste...@stardog.com
Hi Stephen!

We tested this behaviour and narrowed it down to the versioning API. In our Java code, the following code starts the connection, but after executing close, the connection is still present (we used a commercial license and the `stardog-admin server status` tool as you recommended):

try (VersioningConnection conn = this.connectionConfiguration.connect()
                                                             .as(VersioningConnection.class);
     TupleQueryResult result = conn.getVersioningMetadata().select(query).execute()) {
  while (result.hasNext()) {
    BindingSet bindings = result.next();
    // read results
  }
}


We also tested directly using the command line tool and reproduced the bad behaviour as well:


$ stardog-admin db create -o versioning.enabled=true -n myDb
Successfully created database 'myDb'.

$ stardog-admin server status | grep myDb -B2
|  Name   | Conn. Open | Trans. Open | Running Queries | Query Avg. Time (ms) | Query/sec |
+---------+------------+-------------+-----------------+----------------------+-----------+
| myDb    |          0 |           0 |               0 |                  0.0 |       0.0 |

$ stardog vcs list myDb
Version:   677658fb-0a8b-4349-8b6f-c07724d51888
Committer: admin
Date:      2016-12-05 13:04:05

    Database creation

$ stardog-admin server status | grep myDb -B2
|  Name   | Conn. Open | Trans. Open | Running Queries | Query Avg. Time (ms) | Query/sec |
+---------+------------+-------------+-----------------+----------------------+-----------+
| myDb    |          1 |           0 |               0 |                  0.0 |       0.0 |

$ sleep 60

$ stardog-admin server status | grep myDb -B2
|  Name   | Conn. Open | Trans. Open | Running Queries | Query Avg. Time (ms) | Query/sec |
+---------+------------+-------------+-----------------+----------------------+-----------+
| myDb    |          1 |           0 |               0 |                  0.0 |       0.0 |


Please let me know if there is a workaround for this issue, as we rely on this versioning API.

Cheers!

Ruben
Reply all
Reply to author
Forward
0 new messages