Issue Details (XML | Word | Printable)

Key: CORE-3786
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Alexander Peshkov
Reporter: Samo Dadela
Votes: 1
Watchers: 2
Operations

If you were logged in you would be able to see more operations.
Firebird Core

Firebird 2.5.1 Classic (32-bit) Hangs on MacOSX 10.7 (Lion) on DB create after reboot

Created: 08/Mar/12 06:44 PM   Updated: 23/Apr/13 01:44 PM
Component/s: None
Affects Version/s: 3.0 Initial, 2.5.1
Fix Version/s: 2.5.2, 3.0 Alpha 1

Time Tracking:
Not Specified

File Attachments: 1. Text File fb_inet_server_localhost_stacktrace_08032012.txt (8 kB)
2. File fbhang.sh (0.4 kB)
3. Text File isql_localhost_stacktrace_08032012.txt (2 kB)
4. Text File isql_stacktrace_08032012.txt (4 kB)
5. Text File isql_vg_08032012.txt (21 kB)

Environment:
MacOSX Lion 10.7.3 (fully updated) - happened also on 10.7.2
Hardware: mac mini server i7 8G RAM

Planning Status: Unspecified


 Description  « Hide
Firebird hangs with simple db create only first time after the machine is (re)booted.

How to reproduce:
1. Install Firebird Classic MacOSX 32-bit:
    October 04, 2011 / FirebirdCS-2.5.1-26351-i386.pkg.zip / 14 MB / MacOS X 10.6+ 32-bit Classic, Superclassic & Embedded (Intel) package, compressed
2. Add user to firebird user group:
    # sudo dscl . append Groups/firebird GroupMembership username
3. Reboot!
4. Run:
    # /Library/Frameworks/Firebird.framework/Versions/A/Resources/bin/isql
   SQL> create database '/tmp/hang.db' user 'SYSDBA' password 'masterkey';
   SQL> quit; <---- *** hang when enter is pressed ***

Note: If isql is then killed and the operation is retried - it just works (does not hang)... until the next reboot. The hang happens about 90% of the time.



 All   Comments   Work Log   Change History   Version Control   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Samo Dadela added a comment - 08/Mar/12 06:47 PM - edited
Add stacktrace of hang (obtained with killall -11 isql).
isql_stacktrace_08032012.txt

Samo Dadela added a comment - 08/Mar/12 06:50 PM - edited
Add test script: fbhang.sh
Reboot is required prior to running it to reproduce problem!

Samo Dadela added a comment - 08/Mar/12 07:02 PM
Some comments:
- the "how to reproduce" is only the simplest way to reproduce the problem; it was noticed as random hangs in my app (for example on IBPP::Fetch).
- the problem does not happen on Snow Leopard (10.6); though the 10.6 system may not be comparable since it is a very old (and slow) system.
- after the first hang, if the operation is retried the database is successfully created; also firebird works without a problem until the system is booted again.
- sometimes (very rarely) it can hang twice or more times in a row.
- it seems that once the database is created and the system is rebooted you can connect normally to the previously created database
- tried setting FIREBIRD_LOCK to something different than /tmp/firebird - does not help.
- if FIREBIRD_LOCK is used and the lock files survive reboot; it seams that the problem happens less often (note the 'seams', I might be wrong)

Possible 'workaround':
- before creating your database, call isql to create a dummy database and if it hangs, kill it.
- you should be able to create your real database now.

Samo Dadela added a comment - 08/Mar/12 07:51 PM - edited
Tried using "localhost:/tmp/hang.db" as the database name. BTW: is this Superserver or Superclassic?

This time isql hangs on poll() (Select::select) waiting for fb_inet_server.
However fb_inet_server hangs in a similar way as before.

See attached stacktraces.

Samo Dadela added a comment - 08/Mar/12 07:53 PM - edited
Stacktraces of hang using localhost:/
isql_localhost_stacktrace_08032012.txt
fb_inet_server_localhost_stacktrace_08032012.txt

Samo Dadela added a comment - 08/Mar/12 09:18 PM
Attaching valgrind output of isql hang using "/tmp/hang.db" as the database name.

Valgrind/memcheck (32-bit) was invoked as:

FB=/Library/Frameworks/Firebird.framework/Versions/A/Resources/bin
DB=/tmp/hang.db

(
printf "create database '%s' user 'SYSDBA' password 'masterkey';\n" "${DB}"
printf "quit;\n"
) | /usr/local/bin/valgrind \
  --dsymutil=yes \
  --num-callers=50 \
  --max-stackframe=4048000 \
  --track-origins=yes \
  --leak-check=full \
  "${FB}/isql" -q > /tmp/isql_vg_08032012.txt 2>&1

There are some suspicious "points to uninitialized bytes" messages.
Source line numbers are not shown since I don't have the debug version.

See: isql_vg_08032012.txt

Samo Dadela added a comment - 19/Apr/12 06:25 AM
Anyone update on this?

This is a critical issue and it would be nice if it makes it into 2.5.2.