[
https://issues.apache.org/jira/browse/GUACAMOLE-942?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17181623#comment-17181623
]
Stefan Bluhm commented on GUACAMOLE-942:
----------------------------------------
After you updated the description, I am not sure if I reported the same issue.
In my originally reported case, the issue derived right after upgrading. There
have never been any active RDP connections for me. This certainly depends on
the definition of active. It is possible that there was an active connection
before the update and I just closed the browser. But I expect that there was a
significant time between closing the browser and the update.
This was also repeatable continuously in that situation for me. Not a one off
or sporadic.
> Query may fail if all connections disconnect while listing active connections
> -----------------------------------------------------------------------------
>
> Key: GUACAMOLE-942
> URL: https://issues.apache.org/jira/browse/GUACAMOLE-942
> Project: Guacamole
> Issue Type: Bug
> Components: guacamole-auth-jdbc
> Affects Versions: 1.1.0
> Reporter: Stefan Bluhm
> Assignee: Mike Jumper
> Priority: Minor
> Attachments: catalina.zip
>
>
> The content of [{{getActiveConnections()}} within
> {{AbstractGuacamoleTunnelService}}|https://github.com/apache/guacamole-client/blob/ae4361ab70dae4829b08f34a80b08fac885703ba/extensions/guacamole-auth-jdbc/modules/guacamole-auth-jdbc-base/src/main/java/org/apache/guacamole/auth/jdbc/tunnel/AbstractGuacamoleTunnelService.java#L623]
> currently does the following:
> # Check if there are zero active connections. If there aren't any, just
> return an empty set.
> # Produce the set of connection identifiers associated with all active
> connections. {color:red}<-- race condition{color}
> # Retrieve the subset of those connection identifiers that are actually
> readable.
> There is a race condition here, as the set of active connections is a live,
> concurrently-modifiable map. If there are active connections at the
> beginning, but all of those connections disconnect prior to producing the set
> of connection identifiers, then the set of identifiers will be empty. When
> this empty set is passed to the {{selectReadable()}} query that follows, an
> internal error will result:
> {code:none}
> 17:02:02.435 [http-nio-8080-exec-3] ERROR o.a.g.rest.RESTExceptionMapper -
> Unexpected internal error:
> ### Error querying database. Cause:
> com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You have an error
> in your SQL syntax; check the manual that corresponds to your MariaDB server
> version for the right syntax to use near 'AND
> (
> guacamole_connection_permission.entity_id = 7
> ' at line 19
> ### The error may exist in
> org/apache/guacamole/auth/jdbc/connection/ConnectionMapper.xml
> ### The error may involve defaultParameterMap
> ### The error occurred while setting parameters
> ### SQL: SELECT guacamole_connection.connection_id,
> guacamole_connection.connection_name, parent_id, protocol, max_connections,
> max_connections_per_user, proxy_hostname, proxy_port,
> proxy_encryption_method, connection_weight, failover_only, MAX(start_date) AS
> last_active FROM guacamole_connection JOIN guacamole_connection_permission ON
> guacamole_connection_permission.connection_id =
> guacamole_connection.connection_id LEFT JOIN guacamole_connection_history ON
> guacamole_connection_history.connection_id =
> guacamole_connection.connection_id WHERE guacamole_connection.connection_id
> IN AND ( guacamole_connection_permission.entity_id = ? ) AND permission =
> 'READ' GROUP BY guacamole_connection.connection_id; SELECT
> primary_connection_id, guacamole_sharing_profile.sharing_profile_id FROM
> guacamole_sharing_profile JOIN guacamole_sharing_profile_permission ON
> guacamole_sharing_profile_permission.sharing_profile_id =
> guacamole_sharing_profile.sharing_profile_id WHERE primary_connection_id IN
> AND ( entity_id = ? ) AND permission = 'READ'; SELECT
> guacamole_connection_attribute.connection_id, attribute_name, attribute_value
> FROM guacamole_connection_attribute JOIN guacamole_connection_permission ON
> guacamole_connection_permission.connection_id =
> guacamole_connection_attribute.connection_id WHERE
> guacamole_connection_attribute.connection_id IN AND ( entity_id = ? ) AND
> permission = 'READ';
> ### Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLSyntaxErrorException: You
> have an error in your SQL syntax; check the manual that corresponds to your
> MariaDB server version for the right syntax to use near 'AND
> (
> guacamole_connection_permission.entity_id = 7
> ' at line 19
> {code}
> Though the above has been reported several times as a possible cause of
> failures to connect to remote desktops, this error does not actually result
> in connection failure. Its association with connection failures is a red
> herring, and [it has been confirmed that intentionally causing this error
> will not result in an otherwise functional connection
> failing|https://issues.apache.org/jira/browse/GUACAMOLE-942?focusedCommentId=17150530&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-17150530].
> It is simply more likely for this error to occur if connections are failing
> on their own.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)