Bug 34432 - firebird ODBC: LibO crashes on 64 bits
Summary: firebird ODBC: LibO crashes on 64 bits
Status: RESOLVED FIXED
Alias: None
Product: LibreOffice
Classification: Unclassified
Component: Base (show other bugs)
Version:
(earliest affected)
3.3.0 release
Hardware: x86-64 (AMD64) Linux (All)
: high critical
Assignee: Lionel Elie Mamane
URL:
Whiteboard: target:3.6.0 target:3.5.0rc3 target:3...
Keywords:
Depends on:
Blocks: mab3.5
  Show dependency treegraph
 
Reported: 2011-02-18 02:47 UTC by sasha.libreoffice
Modified: 2012-01-31 09:12 UTC (History)
2 users (show)

See Also:
Crash report or crash signature:


Attachments
config odbc place it in /etc (243 bytes, application/x-wine-extension-ini)
2011-02-22 07:12 UTC, sasha.libreoffice
Details
config odbc place it in /etc (752 bytes, application/x-wine-extension-ini)
2011-02-22 07:13 UTC, sasha.libreoffice
Details
backtrace of crash in master 23 jan 2012 (24.09 KB, text/x-log)
2012-01-23 07:19 UTC, sasha.libreoffice
Details
patch to FireBird ODBC for Debian GNU/Linux amd64 (2.70 KB, patch)
2012-01-31 07:55 UTC, Lionel Elie Mamane
Details

Note You need to log in before you can comment on or make changes to this bug.
Description sasha.libreoffice 2011-02-18 02:47:01 UTC
On my work we use database on Firebird. Firebird works ok. For us will be great to work with database using Libreoffice Base. But on Linux 64 bit it not works. On windows 32 bit it works, connecting to Firebird using ODBC.

I have downloaded from FirebirdSQL.org driver OdbcFb-LIB-RC2-2.0.0150.amd64.tar.gz and source  OdbcFb-Source-RC2-2.0.0150.tar.gz
Then I have read files in source_dir/Install/Linux of OdbcFb-Source
and have done what there written. Database employee.fdb become registered in system.
Then I tried to open this database with Base using ODBC.
Office hangs and behaves like fork-bomb (consumes almost all system resources).
I was needed to kill office.
When I start WireShark, I see that when office connects to Firebrid, it reads information about database, tables, some other information, then hangs keeping connection alive. When i kill office, connection closes. Numer of TCP port is 3050.
On site FirebirdSQL.org I found mention about this problem, but Firebird developer tells, that hi needs simply and short explanation of this problem. Hi can not dig deep in office internals.

Please, help to fix this problem or write small program to demonstrate it to developers of Firebird and they can then easy understand problem and fix.
Comment 1 Alex Thurgood 2011-02-18 05:03:54 UTC
Hi Sasha,

Maybe you ought to try with a 32bit ODBC driver instead of 64bit. Is there one available ? If so, could you try it and report back ?


I've noticed lots of problems in general trying to get ODBC to work with 64bit/32bit platforms on anything other than Windows (where I haven't tried so I can't say), and I suspect it is in the upstream OOo code.

Alex
Comment 2 sasha.libreoffice 2011-02-22 07:11:15 UTC
I have tryed on Linux 32 on Open Office. And it works. And I have not LibreOffice on Linux 32.

Here I found mention of error http://tracker.firebirdsql.org/browse/ODBC-68?focusedCommentId=19800&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#action_19800

from here I get drivers: http://www.firebirdsql.org/index.php?op=files&id=odbc

I will attach configs that worked ok on 32.
Comment 3 sasha.libreoffice 2011-02-22 07:12:46 UTC
Created attachment 43664 [details]
config odbc place it in /etc
Comment 4 sasha.libreoffice 2011-02-22 07:13:26 UTC
Created attachment 43665 [details]
config odbc place it in /etc
Comment 5 sasha.libreoffice 2011-02-24 06:15:36 UTC
On libreoffice 3.3.1 rusults:
Linux 32 works ok.
Linux 64 crashes. In wisard I have selected "Connect to database ODBC" then on next step "Select source of database: epoloyee" and then on next step appears button "Test connection". I have pressed it. And "Connection is Ok". On next steps Libre Base crashes.
One time it hangs consuming almost all cpu. It was hard to kill it.
Comment 6 Lionel Elie Mamane 2011-12-04 11:15:53 UTC
I fixed a few ODBC-64bits problem in the past months and days. Could you please test again with a daily build? Thanks a lot. Daily builds are at http://dev-builds.libreoffice.org/daily/
Comment 7 sasha.libreoffice 2011-12-10 01:08:18 UTC
(In reply to comment #6)
> I fixed a few ODBC-64bits problem in the past months and days. Could you please
> test again with a daily build? Thanks a lot. Daily builds are at
> http://dev-builds.libreoffice.org/daily/

I have installed file master~2011-12-08_16.45.19_LibO_3.5.0beta0_Linux_x86-64_install-rpm_en-US.tar.gz
on Fedora 16 64-bit with last updates
But LibO exits almost immediately and writes this in console:

create vcl plugin instance with gtk version 2 24 7
Screen
	Resolution/Size   	96*96 1280*1024 17,0"
	Black&White       	0 16777215
	RGB               	0xff0000 0xff00 0xff
	Visual            	24-bit TrueColor ID=0x21
/opt/lodev3.5/program/soffice.bin: symbol lookup error: /usr/lib64/gtk-2.0/2.10.0/engines/liboxygen-gtk.so: undefined symbol: cairo_surface_create_for_rectangle
Exited with code '127'
Comment 8 Lionel Elie Mamane 2011-12-10 23:41:43 UTC
(In reply to comment #7)

> But LibO exits almost immediately and writes this in console:
 
> /opt/lodev3.5/program/soffice.bin: symbol lookup error:
> /usr/lib64/gtk-2.0/2.10.0/engines/liboxygen-gtk.so: undefined symbol:
> cairo_surface_create_for_rectangle
> Exited with code '127'

A fellow developer recommends you try with a clean profile:

Exit LibreOffice (including the quickstarter if you have it running)
Move ~/.libreoffice and ~/,config/libreoffice away (rename them to e.g. libreoffice-CFG.bak), and also ~/.openoffice.org if you still have one. so that LibreOffice will create a fresh new blank profile.
Try again. If it still does not work, I'll try to get a GTK or Fedora guy to look at the problem. (And if it works, we may have another bug that we will file separately.)
Comment 9 Lionel Elie Mamane 2011-12-11 01:53:15 UTC
Actually, I see in the commit log:

 Author: Michael Stahl <mstahl@redhat.com>
 Date:   Sat Dec 10 00:23:42 2011 +0100

    cairo: fix RPATH:
    
    The cairo configure script is called with -Wl,-rpath,"12345ORIGIN"
    with funny results so tweak the quoting so that the $$ makes it through...
    (cherry picked from commit 408672d41b261b33fb3bbc272d25815dda0e2663)

This commit looks like it can be related to the "undefined symbol" problem you are having (and would fix it). So trying with a more recent daily build (from 10 december or later) seems more relevant than the fresh profile (but if the more recent daily fails in the same way, by all means, try the fresh profile, too).

It is probably best to use a libreoffice-3-5 daily (rather than a "master" daily).
Comment 10 sasha.libreoffice 2011-12-12 01:03:49 UTC
I have deleted ~/.libreoffice , but problem remains. LibO even not created new version of ~/.libreoffice . I will try another build of LibO soon.
Comment 11 Lionel Elie Mamane 2011-12-12 01:37:29 UTC
(In reply to comment #10)
> I have deleted ~/.libreoffice , but problem remains. LibO even not created new
> version of ~/.libreoffice .

LibreOffice 3.4 uses ~/.libreoffice, but LibreOffice 3.5 uses ~/.config/libreoffice (or more generally $XDG_CONFIG_HOME/libreoffice). If ~/.libreoffice exists and ~/.config/libreoffice does not exist, then LibreOffice 3.5 migrates (modulo some small details, copies) ~/.libreoffice exists to ~/.config/libreoffice.

So to get a fresh profile in LibreOffice 3.5, you really need to move away (or delete) *both* directories.

> I will try another build of LibO soon.

Great, thanks. I'm waiting for the result of that.
Comment 12 sasha.libreoffice 2011-12-13 03:50:59 UTC
I have downloaded and installed file 
LibO_3.5.0beta0_Linux_x86-64_install-rpm_en-US.tar.gz
It starts Ok. 
Then I have downloaded source of ODBC from there:
http://sourceforge.net/projects/firebird/files/firebird-ODBC-driver/2.0-Release/OdbcFb-Source-2.0.0151.tar.gz
But can not build it, because gcc complains about ambiguity when casting to int in file OdbcJdbc/MainUnicode.cpp
and I can not solve this problem because not know C++, and precompiled driver not works in Fedora or Mandriva.
Comment 13 sasha.libreoffice 2011-12-15 05:23:24 UTC
I can build ODBC driver commenting out one of next lines
   operator int() { return lengthString; }
   operator SQLINTEGER() { return lengthString; }
lines 117 and 120 in file OdbcJdbc/MainUnicode.cpp
Then I start LibO beta0 and connect to database. It connects successful and shows list of tables. Then I double click on first table of database. LibO crashes immediately. With no output on console.
Comment 14 sasha.libreoffice 2011-12-15 05:44:09 UTC
on LibO 3.3.4.1 the same behaviour: connects and shows list of tables ok, but crashes when double click on table. My be change title to "crashes"?
Comment 15 Lionel Elie Mamane 2011-12-15 05:56:48 UTC
(In reply to comment #13)

> Then I start LibO beta0 and connect to database. It connects successful and
> shows list of tables. Then I double click on first table of database. LibO
> crashes immediately. With no output on console.

I'm terribly sorry to insist, but I fixed a problem just like that (with FreeTDS) about a day *after* beta0 was tagged. I really need you to test with a newer LibreOffice. Beta1 would be fine (http://dev-builds.libreoffice.org/pre-releases/rpm/), or a not-ancient daily build.
Comment 16 sasha.libreoffice 2011-12-16 06:20:10 UTC
file LibO-Dev_3.5.0beta1_Linux_x86-64_install-rpm_en-US.tar.gz
version LOdev 3.5.0 
Build ID: 7362ca8-b5a8e65-af86909-d471f98-61464c4
still crashes
Comment 17 Lionel Elie Mamane 2011-12-17 10:36:00 UTC
(In reply to comment #16)
> file LibO-Dev_3.5.0beta1_Linux_x86-64_install-rpm_en-US.tar.gz
> version LOdev 3.5.0 
> Build ID: 7362ca8-b5a8e65-af86909-d471f98-61464c4
> still crashes

OK, I'll try to take a look in early January.
Comment 18 Björn Michaelsen 2011-12-23 11:43:08 UTC
[This is an automated message.]
This bug was filed before the changes to Bugzilla on 2011-10-16. Thus it
started right out as NEW without ever being explicitly confirmed. The bug is
changed to state NEEDINFO for this reason. To move this bug from NEEDINFO back
to NEW please check if the bug still persists with the 3.5.0 beta1 or beta2 prereleases.
Details on how to test the 3.5.0 beta1 can be found at:
http://wiki.documentfoundation.org/QA/BugHunting_Session_3.5.0.-1

more detail on this bulk operation: http://nabble.documentfoundation.org/RFC-Operation-Spamzilla-tp3607474p3607474.html
Comment 19 sasha.libreoffice 2012-01-23 07:19:52 UTC
Created attachment 56039 [details]
backtrace of crash in master 23 jan 2012

it dislikes something here:
solver/unxlngx6/inc/osl/mutex.hxx:85
Comment 20 Lionel Elie Mamane 2012-01-23 07:40:04 UTC
This looks like the ODBC driver has smashed our stack. This may be LO's fault if LO passed it a pointer to a too small memory area. Investigating.
Comment 21 Lionel Elie Mamane 2012-01-23 10:49:19 UTC
I looked at that part of the code and it seems to me the ODBC calls that LibreOffice is doing there are correct. I start thinking it is an ODBC driver bug. I compiled the driver and installed Firebird 2.5. Will try to reproduce within a few days.
Comment 22 Lionel Elie Mamane 2012-01-24 10:51:48 UTC
So, basically I cannot reproduce the same backtrace as attachment 56039 [details], but I can reproduce the crash. With a smashed stack, the backtrace is unreliable anyway...

The reason seems to be passing a too small memory buffer to SQLGetStmtAttr (thus, a bug in LibreOffice), something I thought I had already fixed, but it seems I had fixed only *some* occurrences of the problem and not all of them.

I'm making a new pass to fix the remaining occurrences, which should fix this. Stay tuned.
Comment 23 Lionel Elie Mamane 2012-01-29 12:33:17 UTC
Crash -> critical severity.
Setting regression keyword.
Comment 24 Lionel Elie Mamane 2012-01-29 12:35:42 UTC
Fixed in master (3.6) with commit 19ef5bcc8d9dbcf965f79495e1afd86ac0f22c31
(http://cgit.freedesktop.org/libreoffice/core/commit/?id=19ef5bcc8d9dbcf965f79495e1afd86ac0f22c31).

Patch sent to mailing list for review for inclusion in 3.5.0 and 3.5.1
Comment 25 sasha.libreoffice 2012-01-30 02:00:13 UTC
Thanks for fix! Compiling ...
Comment 26 sasha.libreoffice 2012-01-31 03:02:10 UTC
It not hangs in Master! Thanks!

Now it outputs this:
SQL Status: HY000
Error code: -206

[ODBC Firebird Driver][Firebird]Dynamic SQL Error
SQL error code = -206
Column unknown
TRUE
At line 1, column 33

My be problem is now in ODBC driver itself.
Comment 27 Lionel Elie Mamane 2012-01-31 07:44:35 UTC
Fix has been committed to libreoffice-3-5 and libreoffice-3-5-0. Closing bug.
Comment 28 sasha.libreoffice 2012-01-31 07:45:36 UTC
Thanks
Comment 29 Lionel Elie Mamane 2012-01-31 07:55:01 UTC
Created attachment 56397 [details]
patch to FireBird ODBC for Debian GNU/Linux amd64
Comment 30 Lionel Elie Mamane 2012-01-31 07:57:12 UTC
(In reply to comment #26)
> Now it outputs this:
> SQL Status: HY000
> Error code: -206
 
> [ODBC Firebird Driver][Firebird]Dynamic SQL Error
> SQL error code = -206
> Column unknown
> TRUE
> At line 1, column 33

OK, please file a *new* bug for that; assign it to me, and include precise reproduction instructions (database schema of database to reproduce, ...).

If you could also try with LibreOffice 3.5.0rc3 (or later), that would be nice. 3.5.0rc3 should come out withing a few days. Any remaining issue will most probably be fixed for 3.5.1, not for 3.5.0.

I also attach for your information the patch with which I compiled the Firebird ODBC driver on Debian GNU/Linux amd64.
Comment 31 sasha.libreoffice 2012-01-31 09:12:37 UTC
separate bugreport:
Bug 45453 - Database: error when executing statment