Bug 118022 - Crash when searching record in a form of an external MySQL-database (JDBC-connection)
Summary: Crash when searching record in a form of an external MySQL-database (JDBC-con...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
6.0.4.2 release
Hardware: x86-64 (AMD64) All
: medium normal
Assignee: Julien Nabet
URL:
Whiteboard: target:6.2.0 target:6.1.0.1 target:6.0.6
Keywords: haveBacktrace
Depends on:
Blocks:
 
Reported: 2018-06-06 07:55 UTC by Pascal Becker
Modified: 2018-07-10 18:01 UTC (History)
3 users (show)

See Also:
Crash report or crash signature:


Attachments
ZIP file with database document and sql script for database (10.77 KB, application/x-zip-compressed)
2018-06-06 12:39 UTC, Pascal Becker
Details
gdb bt (14.96 KB, text/plain)
2018-06-14 18:57 UTC, Julien Nabet
Details
bt with debug symbols (5.55 KB, text/plain)
2018-06-14 21:31 UTC, Julien Nabet
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Pascal Becker 2018-06-06 07:55:53 UTC
LibreOffice is crashing when after searching for a record in a database form.

- Open the database form
- Click on the "Find Record" Icon
- Dialog opens
- Click in the column I want to search
- Enter the search term in the text field
- Press the "Find" Button

The search is executed and the found record is marked with a red border. But then after some seconds the Application crashes -> Message: LibreOffice is not working anymore.

Database: MySQL
Driver: com.mysql.jdbc.Driver
Comment 1 Xisco Faulí 2018-06-06 10:42:16 UTC
Thank you for reporting the bug. Please attach a sample document, as this makes it easier for us to verify the bug. 
(Please note that the attachment will be public, remove any sensitive information before attaching it. 
See https://wiki.documentfoundation.org/QA/FAQ#How_can_I_eliminate_confidential_data_from_a_sample_document.3F for help on how to do so.)

I have set the bug's status to 'NEEDINFO'. Please change it back to 'UNCONFIRMED' once the requested document is provided.
Comment 2 Robert Großkopf 2018-06-06 10:46:52 UTC
You use an external database with JDBC-connection.

Please give more information:
- Which connector do you use (version of the connecor)?
- Do you set parameter to the connector to autoconnect with the database if connection is lost?
Comment 3 Pascal Becker 2018-06-06 11:42:52 UTC
Yes, it's an external database. The connector is mysql-connector-java-5.1.43-bin.jar.
I didn't set a parameter for autoconnect. I don't think there isn't such a parameter for that connection.


I have to mention that the form I tested first has some subforms with connections to different tables. I just tested the search function with a form without subforms on a single table and it worked without error. Then I used another form with subforms and LibreOffice crashed again.
Comment 4 Pascal Becker 2018-06-06 12:39:24 UTC
Created attachment 142559 [details]
ZIP file with database document and sql script for database

Just created a sample database document and a mysql database for testing. If you open the form and search for a name, LibreOffice is crashing here.
Comment 5 Robert Großkopf 2018-06-06 14:02:32 UTC Comment hidden (obsolete)
Comment 6 Robert Großkopf 2018-06-06 14:14:57 UTC
Could confirm the database crashes immediately.
Mark one field in the form.
Start "Find Record".
Press "Find".

It is independent from external or internal server. So you could forget comment5.

Tested with
Version: 6.0.4.2
Build-ID: 9b0d9b32d5dcda91d2f1a96dc04c645c450872bf
CPU-Threads: 4; BS: Linux 4.4; UI-Render: Standard; VCL: kde4; 
Gebietsschema: de-DE (de_DE.UTF-8); Calc: group
Comment 7 Robert Großkopf 2018-06-06 14:27:52 UTC
Have tested a little bit more:
The bug appears in a form with a subform, when the subform doesn't show any value. If you try to look for 'Name10' there is a value in the subform. The Search-dialog doesn't crash whole LO when searching for 'Name10'.
Comment 8 Xisco Faulí 2018-06-06 15:40:17 UTC
> It is independent from external or internal server. So you could forget
> comment5.
> 

Hi robert,
Thanks for investigating this.
Any chance you can create a minimal HSQLDB where the issue can be reproduced?
Comment 9 Julien Nabet 2018-06-06 17:21:31 UTC
On pc Debian x86-64 with master sources updated today, I opened the file, changed parameters so I could open the tables.

Then I tried to open the form and got an error message:
Statut SQL: S1009
Parameter index out of range (1 > number of parameters, which is 0).

Mysql 5.6.30.1

For the rest, I don't reproduce the crash but perhaps I missed something.
Comment 10 Alex Kempshall 2018-06-08 09:44:24 UTC
I'm seeing this problem on some of my applications where I have subforms hanging of a main form.

Though in my case it seems to have started with 6.1 and not 6.0.4. So might be a different problem.

My application is a front end for mariadb.

I've converted my application to use hsqldb and can't replicate the problem.

I'm bisecting the code at the moment. Hope that will help someone.
Comment 11 Alex Kempshall 2018-06-11 11:42:00 UTC
Now confirmed that the bug I'm seeing is not the same as reported here. I will open a new ticket.
Comment 12 Alex Kempshall 2018-06-11 11:44:21 UTC
BTW. I can replicate the bug reported by Pascal Becker using the supplied code and data as seen in the attachment.
Comment 13 Alex Kempshall 2018-06-12 09:46:10 UTC
Hi Pascal

I too get a crash when I search in your form.

I also get a crash when I try to edit your form.

Try deleting the "Bemerkung" text box to see if you get the same.
Comment 14 Pascal Becker 2018-06-12 10:01:49 UTC
Hi Alex,

just tried to delete the "Bemerkung" text box as well as the label. Worked perfectly here.

When I try to use the find function afterwards, LibreOffice crashes again like before.
Comment 15 Xisco Faulí 2018-06-13 15:47:01 UTC
Does you get asked for a user and a password when editing the form ?
Comment 16 Pascal Becker 2018-06-14 05:19:37 UTC
Yes, I do. As soon I try to open the form for editing, I get a prompt for username and password.
Comment 17 Xisco Faulí 2018-06-14 09:13:39 UTC
(In reply to Pascal Becker from comment #16)
> Yes, I do. As soon I try to open the form for editing, I get a prompt for
> username and password.

So, how do you reproduce the crash? do you know the user and pass ? could you please share the credentials ?
Comment 18 Pascal Becker 2018-06-14 09:22:01 UTC
(In reply to Xisco Faulí from comment #17)
> (In reply to Pascal Becker from comment #16)
> > Yes, I do. As soon I try to open the form for editing, I get a prompt for
> > username and password.
> 
> So, how do you reproduce the crash? do you know the user and pass ? could
> you please share the credentials ?

It's the username and password to access the database, not for the form itself. So the credentials depend on how you configured the database access on your database server.
Comment 19 Julien Nabet 2018-06-14 09:36:04 UTC
@Xisco: you can change properties of connection by using menu Edition, DB, properties. You can even test the connection.

If you're on Linux, to reproduce this, you must have a local Mysql server + Apache. You can also install phpmyadmin to check you can see your DB. (you'll got to fill your own credentials)
Then import the sql script file with phpmyadmin (there's an import option).
Finally, open the odb file and change properties to use your local server with your credentials.
It's indeed more long than testing an hsqldb but once you'll got an Apache/Mysql server, it'll be quicker the next time.
Comment 20 Julien Nabet 2018-06-14 18:57:21 UTC
Created attachment 142757 [details]
gdb bt

On pc Debian x86-64 with master sources updated today, I could reproduce this.

First, I fixed ParameterNameSubstitution thanks to the Lionel's trick then I followed Robert's comment 6.
Comment 21 Julien Nabet 2018-06-14 21:31:19 UTC
Created attachment 142760 [details]
bt with debug symbols

It seems there are 2 throws of SQLException, the first one is dealt not the second one.
Here's the second one. (if I well understood)
Comment 22 Julien Nabet 2018-06-14 21:52:11 UTC
I submitted this patch for review:
https://gerrit.libreoffice.org/#/c/55836/
Comment 23 Commit Notification 2018-06-15 10:11:43 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "master":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=f94292e8c4d469bd3123e1649b0f2a94d4b357b3

tdf#118022: fix crash when searching record in form by handling SQLException

It will be available in 6.2.0.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 24 Commit Notification 2018-06-18 12:32:59 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-6-1":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=00d244e984589697e9f4d5743ec08e963327e3b9&h=libreoffice-6-1

tdf#118022: fix crash when searching record in form by handling SQLException

It will be available in 6.1.0.1.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.
Comment 25 Julien Nabet 2018-06-19 07:29:50 UTC
For 6.0 branch, patch waiting for review: https://gerrit.libreoffice.org/#/c/55853/
Comment 26 Commit Notification 2018-07-10 18:01:12 UTC
Julien Nabet committed a patch related to this issue.
It has been pushed to "libreoffice-6-0":

http://cgit.freedesktop.org/libreoffice/core/commit/?id=44f72ca3747deb1c8824626f216d295815b5ceff&h=libreoffice-6-0

tdf#118022: fix crash when searching record in form by handling SQLException

It will be available in 6.0.6.

The patch should be included in the daily builds available at
http://dev-builds.libreoffice.org/daily/ in the next 24-48 hours. More
information about daily builds can be found at:
http://wiki.documentfoundation.org/Testing_Daily_Builds

Affected users are encouraged to test the fix and report feedback.