Issue Details (XML | Word | Printable)

Key: CORE-3077
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Alexander Peshkov
Reporter: Gili Buzaglo
Votes: 0
Watchers: 0

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

/etc/init.d/firebird script stops firebird with fbmgr and password

Created: 21/Jul/10 06:45 AM   Updated: 20/Aug/10 08:28 AM
Component/s: None
Affects Version/s: 2.1.1
Fix Version/s: None

File Attachments: 1. Text File firebird (0.9 kB)
2. Text File firebird (0.9 kB)
3. File FirebirdStartupScriptForSolaris.v2 (1 kB)

Environment: solaris x86

 Description  « Hide
Scenario is as follows:
1) change password for sysdba using gsec
2) perform /etc/init.d/firebird stop
It does not stop the firebird correctly since it uses hard coded(in script) masterkey password.

 All   Comments   Change History   Subversion Commits      Sort Order: Ascending order - Click to sort in descending order
Gili Buzaglo added a comment - 21/Jul/10 06:47 AM
The attached file replaces the /etc/init.d/firebird in my system
and it works for me.
Please comment if you know any better solutions

Alexander Peshkov added a comment - 21/Jul/10 07:23 AM
If you do not need multiple instances - our method is OK. Moreover - you need not kill guardian explicitly. Firebird 2.1 is processing signal 15 (I suppose it's send by pkill by default ?) and exits nornally, after which guardian also exits. Please check this to make sure signal is processed correctly. If not - you are in danger of corrupting databases when server is killed by unprocessed signal.

Gili Buzaglo added a comment - 21/Jul/10 02:23 PM
Thanks for your response.
The default is a SIGTERM(15) signal and firebird exists fine.
The problem with current method is:
a) fbmgr -shut runs with sysdba masterkey hard coded. This causes an error after you change sysdba's password.
b) Our service that comes at startup(reboot) stops and starts firebird to make sure all old connections are removed.
This caused fbserver to crash and not come up until I've replaced security2.fdb with a default one.

Alexander Peshkov added a comment - 22/Jul/10 06:14 AM
I know very well what's a problem with current method:-)
Moreover, on linux it's replaced long ago with almost what you suggest, and additional code was added to fbserver to process signals 2 and 15. What I ask you to test is - does this code work correctly on Solaris? If yes, fbserver after pkill will cleanup, call exit(0) and after it fbguard will also shutdown, no need to kill it separately.

Gili Buzaglo added a comment - 23/Jul/10 09:17 AM
For now, it works for me as is ...
I will try next week without the pkill to fbguard.(I read somewhere that fbguard might reinit fbserver, this is why I've
placed it in the first place). Is there any harm leaving it anyway?(I dont want to recreate a flar ..)

Alexander Peshkov added a comment - 23/Jul/10 09:29 AM
If you perform normal shutdown of fbserver (it must be so), fbguard will not reinit it. I ask you about this experiment mainly to make sure that fbserver shutdown is grace on Solaris.

Gili Buzaglo added a comment - 25/Jul/10 06:46 AM
I've tested the attached file(pkill fbserver only) and it works fine.
Thanks for your help.

Alexander Peshkov added a comment - 09/Aug/10 02:33 PM
Gili, reviewing your startup script I've noticed some more problems (compared with 2.1 head, may be for 2.1.1 this changes were not present).

1) Somewhy you export PATH to firebird binaries. This is not needed for firebird to run.
2) Missing change runUser support. If forebird runs as 'root', this is not good from security POV.

I've added a kind of 'ideal' 2.1 startup script. Can you test it in your environment? (I know that if you were always runnign as root it may be problematic to run as non-root, therefore in the worst case change FbRunUser to be root in the script for your tests)

Gili Buzaglo added a comment - 19/Aug/10 06:15 AM
Hi Alexander
Sorry For responding after so long.
I dont like saving the pid into a file. pkill $pname is more safe for me.
I've tried your script, when trying to stop firebird it got stuck.
I've checked and the file with pid was not created.
BTW, if the user calls start 2 times by mistake, will the file still be there?

Alexander Peshkov added a comment - 20/Aug/10 08:28 AM
No problems - certainkly you've needed timeto check for.
With 'pkill $pname' there is one problem - if you need to have more than one FB instance, you can't stop single instance with it. Do not worry any more please - I will activate my VM with Solaris and take care for scripts.