Bug 122129 - Firebird: app must be forced to end after any use relation designer window - add table function causes immediate hang
Summary: Firebird: app must be forced to end after any use relation designer window - ...
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
5.4.7.2 release
Hardware: All All
: high major
Assignee: Not Assigned
URL:
Whiteboard: target:6.3.0 target:6.2.3 target:6.2.2
Keywords:
Depends on:
Blocks: Database-Firebird-Default
  Show dependency treegraph
 
Reported: 2018-12-15 19:49 UTC by Drew Jensen
Modified: 2019-05-16 14:03 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
Example file made with LO6.2Beta1 - no current relationships defined (16.52 KB, application/vnd.oasis.opendocument.database)
2018-12-15 19:49 UTC, Drew Jensen
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Drew Jensen 2018-12-15 19:49:38 UTC
Created attachment 147584 [details]
Example file made with LO6.2Beta1 - no current relationships defined

Test system is Ubuntu 18.04.1 (AMD64) found this problem with LO versions 5.4.7.2 -> 6.3Alpha0; firebird embedded and firebird file sdbc

To reproduce:
scenario 1
1 - open the attached database
2 - in the tables section open the Relationship designer window
The cursor, while over the relation area of the window will say in busy state.
3 - close the relationship window
4 - try to close the ODB file
result 
Application must be killed to close file

scenario 2
1 - open the attached database
2 - in the tables section open the Relationship designer window
3 - open the Add Table dialog from toolbar or menu
4 - double click on one of the tables
result
Application stops responding to input, system will prompt to stop process or wait
Comment 1 Drew Jensen 2018-12-15 19:51:24 UTC
Added Bug 52310 - "Calling Relations tool with LO Base and mysql native connector appears to freeze LO pushing user to force kill the app" since it seems very similar.
Comment 2 Robert Großkopf 2018-12-16 08:32:07 UTC
Could confirm the buggy behaviour.

Note: If I define the relationship directly after I had created the database and didn't close the database it will work. It won't work when the database will be opened again.
Comment 3 Robert Großkopf 2019-01-02 08:39:02 UTC
... and a second note:
I just fall for this bug while creating a Firebird-database in LO 6.1.4.2. Couldn't define a relationship because I had closed the database before.

I have created a new table to the database. Then I could create the relationship for the existing tables. Must only delete the useless table I created for this afterwords.

So this bug won't appear if you create a table in the same session you will create the relationship.
Comment 4 Tamas Bunth 2019-01-31 15:53:11 UTC
Hi,

These are my observations:

- The bug is not always reproducible. It happens after around half of my attempts for me.

- LibreOffice hangs after multiple concurrent calls of isc_dsql_prepare. The problem is that Firebird lands in a deadlock.

- Those calls are initiated by separate threads started at RelationLoader::run() [1]

- The threads use the very same connection, but separate statements.

According to this [2] and this [3] Firebird should be thread-safe in a manner that multiple threads are allowed, if they are working on the same connection object.

That means that it might be a bug of Firebird, and not ours. Although it would be good to get rid of the problem. A workaround could be not to allow multiple calls of OStatementCommonBase::prepareAndDescribeStatement related to the same connection object.

[1] dbaccess/source/ui/relationdesign/RelationController.cxx
[2] https://firebirdsql.org/rlsnotesh/rnfb25-engine.html
[3] https://www.firebirdsql.org/file/documentation/reference_manuals/driver_manuals/odbc/html/fbodbc205-threading.html
Comment 5 Commit Notification 2019-02-04 20:33:15 UTC
Tamas Bunth committed a patch related to this issue.
It has been pushed to "master":

https://git.libreoffice.org/core/+/6affbd2b57a336749a6a2ab3466a4e652a7ff365%5E%21

tdf#122129 Firebird: fix concurrency issue

It will be available in 6.3.0.

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

Affected users are encouraged to test the fix and report feedback.
Comment 6 Xisco Faulí 2019-03-13 18:37:56 UTC
A polite ping to Tamas Bunth:
Is this bug fixed? if so, could you please close it as RESOLVED FIXED ? Otherwise, Could you please explain what's missing?
Thanks
Comment 7 Robert Großkopf 2019-03-13 18:54:59 UTC
Relationships could be added here with LO 6.1.5.2 to the example database. But couldn't be added with LO 6.2.1.2. LO hangs when opening the window for creating relationships. The dialogue for choosing a table will never appear.

Tested with OpenSUSE 15 64bit rpm Linux

With 
Version: 6.3.0.0.alpha0+
Build ID: bbc5347be70d11d187cd537dd73cdab584def719
CPU threads: 6; OS: Linux 4.12; UI render: default; VCL: gtk3; 
TinderBox: Linux-rpm_deb-x86_64@86-TDF, Branch:master, Time: 2019-03-03_20:19:18
Locale: de-DE (de_DE.UTF-8); UI-Language: en-US
Calc: threaded
it will work.

So this patch should be backported to 6.2
Comment 8 Xisco Faulí 2019-03-13 21:22:11 UTC
Done -> https://gerrit.libreoffice.org/#/c/69227/
Comment 9 Commit Notification 2019-03-14 20:26:10 UTC
Tamas Bunth committed a patch related to this issue.
It has been pushed to "libreoffice-6-2":

https://git.libreoffice.org/core/+/bd5ef0f1ecb445021fc693bfd3cab0979a4c4c28%5E%21

tdf#122129 Firebird: fix concurrency issue

It will be available in 6.2.3.

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

Affected users are encouraged to test the fix and report feedback.
Comment 10 Commit Notification 2019-03-15 20:00:08 UTC
Tamas Bunth committed a patch related to this issue.
It has been pushed to "libreoffice-6-2-2":

https://git.libreoffice.org/core/+/bbab72ced58e469e6394e853ce0013f3699d85d3%5E%21

tdf#122129 Firebird: fix concurrency issue

It will be available in 6.2.2.

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

Affected users are encouraged to test the fix and report feedback.
Comment 11 Mike Sapsard 2019-03-22 18:34:19 UTC
I loaded the AppImage of 6.3 for linux x64 on 2019-12-15. (Linus Mint 19.1 with all Firebird libs loaded. It allowed me to create new tables and relations.
I then closed that version and tried to open the tables with 6.2.1.2 and could no longer open or create tables with 6.3.
Comment 12 Mike Sapsard 2019-03-22 18:35:45 UTC
(In reply to Mike Sapsard from comment #11)
> I loaded the AppImage of 6.3 for linux x64 on 2019-12-15. (Linus Mint 19.1
> with all Firebird libs loaded. It allowed me to create new tables and
> relations.
> I then closed that version and tried to open the tables with 6.2.1.2 and
> could no longer open or create tables with 6.3.

2019-12-15 should read 2019-03-22.
Comment 13 Xisco Faulí 2019-05-16 10:35:05 UTC
A polite ping to Tamas Bunth:
Is this bug fixed? if so, could you please close it as RESOLVED FIXED ?
Otherwise, Could you please explain what's missing?
Thanks
Comment 14 Robert Großkopf 2019-05-16 14:03:27 UTC
The patch has been pushed to LO 6.2 (see comment 9 and 10). Have tested it with LO 6.2.3.2 and OpenSUSE 64bit rpm Linux. Could create relations in the designer-window with the database-example.

I will set this one to RESOLVED and FIXED.