Bug 119431 - External database jdbc hsqldb, Crash in the case of SELECT, SQL query, access to the database
Summary: External database jdbc hsqldb, Crash in the case of SELECT, SQL query, access...
Status: NEW
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.1.0.3 release
Hardware: x86-64 (AMD64) Windows (All)
: medium normal
Assignee: Not Assigned
URL:
Whiteboard:
Keywords: haveBacktrace
Depends on:
Blocks: Database-Connectivity
  Show dependency treegraph
 
Reported: 2018-08-22 20:57 UTC by Krzysztof
Modified: 2023-12-08 03:14 UTC (History)
4 users (show)

See Also:
Crash report or crash signature: ["rtl_string_newFromStr"]


Attachments
gdb bt (21.44 KB, text/plain)
2018-10-18 19:54 UTC, Julien Nabet
Details
gdb bt detailed (18.64 KB, text/plain)
2018-10-18 20:09 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Krzysztof 2018-08-22 20:57:17 UTC
This bug was filed from the crash reporting server and is br-aae507c3-49a0-4cc0-9ded-90f140bf7dfb.
=========================================

I'm creating a new, clean database.
I enter SQL queries:
CREATE ROLE "normal_user";
CREATE USER "U1" PASSWORD "12345";
CREATE CACHED TABLE "Test2" ("ID" INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 0) NOT NULL PRIMARY KEY, "name" VARCHAR (100) NOT NULL, "addDateTime" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
"updateDateTime" TIMESTAMP NULL);
CREATE TRIGGER PUBLIC. "Test2_TRG" BEFORE UPDATE ON PUBLIC. "Test2" REFERENCING OLD ROW AS OLDROW NEW ROW AS NEWROW FOR EACH ROW SET NEWROW. "UpdateDateTime" = CURRENT_TIMESTAMP;
GRANT SELECT (ID, "name"), UPDATE (ID, "name"), INSERT (ID, "name") ON TABLE "Test2" TO "normal_user";
GRANT "normal_user" TO "U1";

The commands were completed successfully.

We log in as U1, open the "Test2" table. Total crash Libreoffice.

Crash in: rtl_string_newFromStr
Comment 1 Drew Jensen 2018-08-22 21:33:21 UTC
@Krzysztof could you add which version of the HSQL server you are using (also is this local host) and which if any options you are including in your JDBC connection string? Thanks
Comment 2 Krzysztof 2018-08-23 05:26:45 UTC
HSQLDB version 2.4.1

Class Driver: org.hsqldb.jdbcDriver

(Server on another computer, name base GR alias to xGR)
URL Jdbc: hsqldb:hsql://10.1.1.102/xGR
Comment 3 Xisco Faulí 2018-08-23 08:26:40 UTC
You can't confirm your own bugs. Moving it back to UNCONFIRMED until someone
else confirms it.
Comment 4 Krzysztof 2018-08-23 16:31:47 UTC
The same situation at the file base.

Data source URL:
jdbc: hsqldb:file:///H:/database/mydb;default_schema=true;shutdown=true;hsqldb.default_table_type=cached;get_column_name=false

I create SQL queries as above.

When you try to access the database, the user U1 (not admin) follows total crash Libreoffice.
Comment 5 Krzysztof 2018-08-23 16:33:48 UTC
(In reply to Xisco Faulí from comment #3)
> You can't confirm your own bugs. Moving it back to UNCONFIRMED until someone
> else confirms it.

Sorry I do not know. This is my first bug report.
Comment 6 Drew Jensen 2018-08-23 16:52:14 UTC
(In reply to Krzysztof from comment #5)
> (In reply to Xisco Faulí from comment #3)
> > You can't confirm your own bugs. Moving it back to UNCONFIRMED until someone
> > else confirms it.
> 
> Sorry I do not know. This is my first bug report.

Ok - well, I have some time this afternoon to look at this.

Unfortunately I'll be using Linux so that me be invalid if this is a MS Windows issue. For instance I have libreOfffice 6.1.03 open right now a HSQL embedded file open and working without any problems.

Before I start though I can tell  you that if you are attempting to use the schema in the first comment, including user accounts, in an embedded database that was in the past problematic. It worked fine if you access all your tables/queries/forms/reports via scripts in which you create a separate connection with the none sysdba user account, but the Base UI had real problems as it always defaults to the default sysdba account. BTW that also allows full (meaning multi-table/edit) transaction control in an embedded Base file, something the Base UI interface doesn't fully support.

Secondly there was an old issue regarding external HSQL drivers. In the Options->Advanced dialog you not only can set the Java install to use (for instance I have both 10.02 and 1.8.0_181 available, I use 10.02) but with the 'Class path' you can also pick an external hsql driver over the LibreOffice supplied file - this was necessary in a few builds for the external connection to work, but then made it impossible to work with the embedded Base files.

If you picked an external jdbc driver with that class parameter that could be the problem with the embedded Base file.
Comment 7 Alex Thurgood 2018-08-24 08:36:33 UTC
The line "rtl_string_newFromStr" is used in file string path building and management:

https://api.libreoffice.org/docs/cpp/ref/a00385.html#ae08c76f4d35c4e7d3b2904d849b3b7a2

It might be that LibreOffice is having an issue with the handling of the path to your external hssqldb.
Comment 8 Alex Thurgood 2018-08-24 08:55:09 UTC
Your crash trace however, shows unhandled debug exceptions being thrown in dbtools2.cxx, at lines 827 and 828, in a block of code which, if I've understood it correctly, attempts to obtain column information about the fields of your database.
Comment 9 Krzysztof 2018-08-24 12:58:02 UTC
(In reply to Alex Thurgood from comment #8)
> Your crash trace however, shows unhandled debug exceptions being thrown in
> dbtools2.cxx, at lines 827 and 828, in a block of code which, if I've
> understood it correctly, attempts to obtain column information about the
> fields of your database.

Exactly. This SQL query limits access to the Test2 table (has 4 columns) for the normal_user role:
GRANT SELECT (ID, "name"), UPDATE (ID, "name"), INSERT (ID, "name") ON TABLE "Test2" TO "normal_user";

When attempting any access, it causes a crash Libreoffice. There should be an exception. Even if I use the SQL query allowed:
SELECT "ID", "name" FROM "Test2"
there is a crash Libreoffice.
Comment 10 Julien Nabet 2018-09-12 20:32:03 UTC
I tried to reproduce this but had this error message when typing:
CREATE TRIGGER PUBLIC. "Test2_TRG" BEFORE UPDATE ON PUBLIC. "Test2" REFERENCING OLD ROW AS OLDROW NEW ROW AS NEWROW FOR EACH ROW SET NEWROW. "UpdateDateTime" = CURRENT_TIMESTAMP;

1: Unexpected end of command: REFERENCING in statement [CREATE TRIGGER PUBLIC. "Test2_TRG" BEFORE UPDATE ON PUBLIC. "Test2" REFERENCING]
Comment 11 Julien Nabet 2018-09-12 20:33:51 UTC
Also, I don't know if it's related but I had to restart Base because Test2 table didn't appear after CREATE CACHED TABLE statement.

(I use hsqldb1.8.0.jar from Debian)
Comment 12 Krzysztof 2018-09-13 08:28:13 UTC
(In reply to Julien Nabet from comment #11)
> Also, I don't know if it's related but I had to restart Base because Test2
> table didn't appear after CREATE CACHED TABLE statement.
> 
> (I use hsqldb1.8.0.jar from Debian)

It must be HSQLDB version 2.4.1.
Comment 13 Julien Nabet 2018-09-13 08:31:18 UTC
(In reply to Krzysztof from comment #12)
> ...
> It must be HSQLDB version 2.4.1.

Thank you for your feedback and sorry for the noise since you had already provided this piece of information in comment 2.

I'll give it a try after my daytime job.
Comment 14 Julien Nabet 2018-09-13 18:53:49 UTC
I could launch every command, I noticed this for
CREATE TRIGGER PUBLIC. "Test2_TRG" BEFORE UPDATE ON PUBLIC. "Test2" REFERENCING OLD ROW AS OLDROW NEW ROW AS NEWROW FOR EACH ROW SET NEWROW. "UpdateDateTime" = CURRENT_TIMESTAMP;

4: user lacks privilege or object not found: UpdateDateTime

I don't know if it's ok or not but anyway I don't know how to log to the base as U1.
I closed the file and reopen, no login is required.
Comment 15 ribotb 2018-10-17 08:24:58 UTC
I reproduce with :

Version: 6.1.0.3 (x64)
Build ID: efb621ed25068d70781dc026f7e9c5187a4decd1
Threads CPU : 4; OS : Windows 10.0; UI Render : par défaut; 
Locale : fr-FR (fr_FR); Calc: group threaded

HSQLDB version 2.4.1

Windows 10 1803


I created the database using the admin user (SA) with :
hsqldb:file:///<my path>/mydb;default_schema=true;shutdown=true;hsqldb.default_table_type=cached;get_column_name=false

Then I executed the  Krzysztof 's DDL.

Then: Edit > Database > Properties to replace user SA by user U1.
I close, save and reopen database.

Reconnection. 

CRASH when I try to open Test2 or with SQL statement: SELECT "ID", "name" FROM "Test2"

Bernard
Comment 16 Julien Nabet 2018-10-17 08:50:31 UTC
Let's put this one to NEW since it's been reproduced.
Comment 17 Xisco Faulí 2018-10-17 17:30:18 UTC
@Krzysztof,
Could you please confirm the issue is still reproducible in LibreOffice master from http://dev-builds.libreoffice.org/daily/master/ ?
You can install it alongside the standard version.
Comment 18 ribotb 2018-10-17 18:25:37 UTC
Also reproduced with 

Version: 6.2.0.0.alpha0+ (x64)
Build ID: c8481c8a43ce2544275b2d70ef29a8b0cb157732
CPU threads: 4; OS: Windows 10.0; UI render: default; VCL: win; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2018-10-11_00:41:23
Locale: fr-FR (fr_FR); Calc: threaded
Comment 19 Julien Nabet 2018-10-17 19:24:48 UTC
(In reply to ribotb from comment #15)
> I reproduce with :
> 
> ...
> I created the database using the admin user (SA) with :
> hsqldb:file:///<my
> path>/mydb;default_schema=true;shutdown=true;hsqldb.
> default_table_type=cached;get_column_name=false
How to do this? I mean, you launched Base then what?
Would it be possible you attach the file just before the last steps to reproduce the crash?
Comment 20 ribotb 2018-10-17 20:52:19 UTC
(In reply to Julien Nabet from comment #19)
> (In reply to ribotb from comment #15)
> > I reproduce with :
> > 
> > ...
> > I created the database using the admin user (SA) with :
> > hsqldb:file:///<my
> > path>/mydb;default_schema=true;shutdown=true;hsqldb.
> > default_table_type=cached;get_column_name=false
> How to do this? I mean, you launched Base then what?
> Would it be possible you attach the file just before the last steps to
> reproduce the crash?

File > New > database

Connect to an existing database + JDBC

Datasource URL : jdbc: hsqldb:file:///H:/database/mydb;default_schema=true;shutdown=true;hsqldb.default_table_type=cached;get_column_name=false

JDBC driver class : org.hsqldb.jdbcDriver

User name : SA (HSQLDB Admin user)
[X] password required 

After the creation of odb file ;
Tools > SQL to create table, user, etc.
Comment 21 ribotb 2018-10-18 08:58:16 UTC
I have tested with LO 5.4.7:  
The table Test2 cannot be opened with user U1 but LO547 does not crash, there is only an error message : 

"user lacks privilege or object not found: Test2 in statement [SELECT * FROM "Test2"] "

If this can help you...
Comment 22 Julien Nabet 2018-10-18 19:54:49 UTC
Created attachment 145812 [details]
gdb bt

Thank you ribotb for your help.
On pc Debian x86-64 with master sources updated I could reproduce this.

I attached bt + some gdb session.
Comment 23 Julien Nabet 2018-10-18 20:09:57 UTC
Created attachment 145813 [details]
gdb bt detailed

I added some traces to see a bit more precisely where it segfaults and retrieved this bt.
Comment 24 Krzysztof 2018-10-21 15:39:42 UTC
(In reply to ribotb from comment #21)
> I have tested with LO 5.4.7:  
> The table Test2 cannot be opened with user U1 but LO547 does not crash,
> there is only an error message : 
> 
> "user lacks privilege or object not found: Test2 in statement [SELECT * FROM
> "Test2"] "
> 
> If this can help you...

This is the correct operation.
Comment 25 Krzysztof 2018-10-21 19:37:58 UTC
(In reply to Xisco Faulí from comment #17)
> @Krzysztof,
> Could you please confirm the issue is still reproducible in LibreOffice
> master from http://dev-builds.libreoffice.org/daily/master/ ?
> You can install it alongside the standard version.

I'm creating a new, clean database.
I enter SQL queries:
CREATE ROLE "normal_user";
CREATE USER "U1" PASSWORD "12345";
CREATE CACHED TABLE "Test2" ("ID" INTEGER GENERATED BY DEFAULT AS IDENTITY (START WITH 0) NOT NULL PRIMARY KEY, "name" VARCHAR (100) NOT NULL, "addDateTime" TIMESTAMP DEFAULT CURRENT_TIMESTAMP NOT NULL,
"updateDateTime" TIMESTAMP NULL);
CREATE TRIGGER PUBLIC. "Test2_TRG" BEFORE UPDATE ON PUBLIC. "Test2" REFERENCING OLD ROW AS OLDROW NEW ROW AS NEWROW FOR EACH ROW SET NEWROW. "updateDateTime" = CURRENT_TIMESTAMP;
GRANT SELECT (ID, "name"), UPDATE (ID, "name"), INSERT (ID, "name") ON TABLE "Test2" TO "normal_user";
GRANT "normal_user" TO "U1";

The commands were completed successfully.

We log in as U1, open the "Test2" table. Total crash Libreoffice.

Version: 6.2.0.0.alpha0+ (x64)
Build ID: 3846561f79cf9065abd9ca83c9fbfbe7e52e28e2
CPU threads: 4; OS: Windows 6.1; UI render: default; VCL: win; 
TinderBox: Win-x86_64@42, Branch:master, Time: 2018-10-21_01:03:30
Locale: pl-PL (pl_PL); Calc: threaded
Comment 26 QA Administrators 2019-12-07 03:42:52 UTC Comment hidden (obsolete)
Comment 27 QA Administrators 2021-12-07 04:56:19 UTC Comment hidden (obsolete)
Comment 28 QA Administrators 2023-12-08 03:14:55 UTC
Dear Krzysztof,

To make sure we're focusing on the bugs that affect our users today, LibreOffice QA is asking bug reporters and confirmers to retest open, confirmed bugs which have not been touched for over a year.

There have been thousands of bug fixes and commits since anyone checked on this bug report. During that time, it's possible that the bug has been fixed, or the details of the problem have changed. We'd really appreciate your help in getting confirmation that the bug is still present.

If you have time, please do the following:

Test to see if the bug is still present with the latest version of LibreOffice from https://www.libreoffice.org/download/

If the bug is present, please leave a comment that includes the information from Help - About LibreOffice.
 
If the bug is NOT present, please set the bug's Status field to RESOLVED-WORKSFORME and leave a comment that includes the information from Help - About LibreOffice.

Please DO NOT

Update the version field
Reply via email (please reply directly on the bug tracker)
Set the bug's Status field to RESOLVED - FIXED (this status has a particular meaning that is not 
appropriate in this case)


If you want to do more to help you can test to see if your issue is a REGRESSION. To do so:
1. Download and install oldest version of LibreOffice (usually 3.3 unless your bug pertains to a feature added after 3.3) from https://downloadarchive.documentfoundation.org/libreoffice/old/

2. Test your bug
3. Leave a comment with your results.
4a. If the bug was present with 3.3 - set version to 'inherited from OOo';
4b. If the bug was not present in 3.3 - add 'regression' to keyword


Feel free to come ask questions or to say hello in our QA chat: https://web.libera.chat/?settings=#libreoffice-qa

Thank you for helping us make LibreOffice even better for everyone!

Warm Regards,
QA Team

MassPing-UntouchedBug