On Fri, Feb 9, 2018 at 5:33 AM, Nick Couchman <vn...@apache.org> wrote:

> On Fri, Feb 9, 2018 at 5:55 AM, sebastian.k <kowatsch.sebast...@outlook.de
> > wrote:
>> Hi there,
>> I've setup guacamole on centos 7.4/rhel with the new MS-SQL extension from
>> version 0.9.14.
>> The problem is that users get "corrupted". After a fresh install I can
>> login
>> once or twice with the guacadmin user without problems. But on the third
>> or
>> forth login attempt I'm getting. "Unexpected internal error". I logged out
>> correctly every time. I also tried installing MS-SQL locally but the
>> results
>> are the same.
>> ...
>> It would be great if someone could tell me what I'm doing wrong.
>> Is somebody using MS SQL 2016 with latest Guacamole 0.9.14 without any
>> trouble?
>> Thanks in advance
>> Sebastian
> It's definitely possible there is an issue with the MS-SQL Extension, but
> I have not run into this particular behavior.

I just managed to reproduce this myself. The problem is within the query
returning user information for a single account. From my test instance's

09:43:47.642 [http-nio-8080-exec-18] DEBUG
o.a.g.a.j.user.UserMapper.selectOne - ==>  Preparing: SELECT
[guacamole_user].user_id, [guacamole_user].username, password_hash,
password_salt, password_date, disabled, expired, access_window_start,
access_window_end, valid_from, valid_until, timezone, full_name,
email_address, organization, organizational_role, ( SELECT MAX(start_date)
FROM [guacamole_user_history] WHERE [guacamole_user_history].user_id =
[guacamole_user].user_id ) AS last_active FROM [guacamole_user] LEFT JOIN
[guacamole_user_history] ON [guacamole_user_history].user_id =
[guacamole_user].user_id WHERE [guacamole_user].username = ?
09:43:47.642 [http-nio-8080-exec-18] DEBUG
o.a.g.a.j.user.UserMapper.selectOne - ==> Parameters: guacadmin(String)
09:43:47.650 [http-nio-8080-exec-18] DEBUG
o.a.g.a.j.user.UserMapper.selectOne - <==      Total: 2
09:43:47.656 [http-nio-8080-exec-18] ERROR o.a.g.rest.RESTExceptionWrapper
- Unexpected internal error: Expected one result (or null) to be returned
by selectOne(), but found: 2
09:43:47.672 [http-nio-8080-exec-18] DEBUG o.a.g.rest.RESTExceptionWrapper
- Unexpected error in REST endpoint.
org.apache.ibatis.exceptions.TooManyResultsException: Expected one result
(or null) to be returned by selectOne(), but found: 2

The new login history tracking is resulting in multiple rows being returned
for a query which *should* be returning only one row, causing result sanity
checks to fail. I'll have to retest against MySQL and PostgreSQL to make
sure this isn't affecting those versions of the database extension, but I
believe this is isolated to SQL Server. The problem is that stray LEFT
JOIN, which should have been removed as part of the following commit:


New issue in JIRA:


- Mike

Reply via email to