-
There are two cases here:
- failure to connect to default data source (default repository)
Without this many components and features may fail to work properly (including clustering) so we should stop a server.
- failure to connect to other data sources
This may return some errors but I think that it should work.
I'm going to review code responsible for initialization of repositories as it may be handy to start a server before DB is started (or while it is starting) and connect to a database as it will become available.
-
I've found that even though the instance of a repository is not initialized properly it is injected to repository pool which leads to NPE during runtime. I made changes in a kernel to make sure it will not happen again. This should fix above NPE.
Moreover, I've added check during bootstrapping of Tigase XMPP Server to make sure that data sources are initialized before we will start loading components - to make it fail-fast with fewer errors being logged.
Please verify that this works for you. We cannot stop server at this point as it may happen that this exception will be thrown during server reconfiguration and stopping server at this point could be very inconvenient.
-
Andrzej Wójcik wrote:
There are two cases here:
- failure to connect to default data source (default repository)
Without this many components and features may fail to work properly (including clustering) so we should stop a server.
+1
- failure to connect to other data sources
This may return some errors but I think that it should work.
I'm not sure about that - it leaves the server in rather half-working state (and I was under the impression that you are in general more in favour of failing that allowing that, for example our discussion in DSL where we consider configuration "bad" if any of the items are wrong instead of ignoring them)
I'm going to review code responsible for initialization of repositories as it may be handy to start a server before DB is started (or while it is starting) and connect to a database as it will become available.
Andrzej Wójcik wrote:
I've found that even though the instance of a repository is not initialized properly it is injected to repository pool which leads to NPE during runtime. I made changes in a kernel to make sure it will not happen again. This should fix above NPE.
Moreover, I've added check during bootstrapping of Tigase XMPP Server to make sure that data sources are initialized before we will start loading components - to make it fail-fast with fewer errors being logged.
Please verify that this works for you.
It works for me, however the is a small but -
'config-type' = 'setup'
results in stopping the server:========== STARTED Tigase Tue May 2 13:10:02 -03 2017 using: ./scripts/tigase.sh start etc/tigase.conf ========== Picked up JAVA_TOOL_OPTIONS: -Djava.awt.headless=true componentInfo{Title=Tigase XMPP Server, Version=7.2.0-SNAPSHOT-b4809/7b560498 (2017-05-01/23:10:40), Class=tigase.xml.XMLUtils} componentInfo{Title=Tigase XMPP Server, Version=7.2.0-SNAPSHOT-b4809/7b560498 (2017-05-01/23:10:40), Class=tigase.util.ClassUtil} componentInfo{Title=Tigase XMPP Server, Version=7.2.0-SNAPSHOT-b4809/7b560498 (2017-05-01/23:10:40), Class=tigase.server.XMPPServer} 2017-05-02 13:10:02.390 [main] ConfiguratorAbstract.parseArgs() CONFIG: Setting defaults: --property-file = etc/init.properties 2017-05-02 13:10:02.486 [main] ConfigHolder.loadConfiguration() CONFIG: Loaded configuration: --test = false 'config-type' = 'setup' http () { setup () { 'admin-password' = 'tigase' 'admin-user' = 'admin' } } ============================================================================= ERROR! Terminating the server process. Problem initializing the server: tigase.kernel.KernelException: Can't find bean implementing class tigase.db.beans.DataSourceBean Please fix the problem and start the server again. ============================================================================= ShutdownThread started... Total number of threads: 5 No locked threads. Save thread-dump to file: logs/thread-dump.log, size: 1689 ShutdownThread finished...
We cannot stop server at this point as it may happen that this exception will be thrown during server reconfiguration and stopping server at this point could be very inconvenient.
Agreed, and before we considered the same:
-
if the server couldn't establish connection to repository during startup = bad state;
-
exception accessing repository after correct startup = ok state (temporary network problem for example that could be recovered).
-
Wojciech Kapcia wrote:
Andrzej Wójcik wrote:
There are two cases here:
- failure to connect to default data source (default repository)
Without this many components and features may fail to work properly (including clustering) so we should stop a server.
+1
- failure to connect to other data sources
This may return some errors but I think that it should work.
I'm not sure about that - it leaves the server in rather half-working state (and I was under the impression that you are in general more in favour of failing that allowing that, for example our discussion in DSL where we consider configuration "bad" if any of the items are wrong instead of ignoring them)
Yes, you are right. I was just thinking about a possible use case.
I'm going to review code responsible for initialization of repositories as it may be handy to start a server before DB is started (or while it is starting) and connect to a database as it will become available.
Andrzej Wójcik wrote:
I've found that even though the instance of a repository is not initialized properly it is injected to repository pool which leads to NPE during runtime. I made changes in a kernel to make sure it will not happen again. This should fix above NPE.
Moreover, I've added check during bootstrapping of Tigase XMPP Server to make sure that data sources are initialized before we will start loading components - to make it fail-fast with fewer errors being logged.
Please verify that this works for you.
It works for me, however the is a small but -
'config-type' = 'setup'
results in stopping the server:[...]
It is already fixed. I've fixed this issue today so it is not part of latest snapshot build.
We cannot stop server at this point as it may happen that this exception will be thrown during server reconfiguration and stopping server at this point could be very inconvenient.
Agreed, and before we considered the same:
- if the server couldn't establish connection to repository during startup = bad state;
- exception accessing repository after correct startup = ok state (temporary network problem for example that could be recovered).
Yes, this is how it works now.
Type |
Bug
|
Priority |
Normal
|
Assignee | |
RedmineID |
5450
|
Version |
tigase-server-8.0.0
|
Spent time |
0
|
We already have a couple of cases where failing to initialise repository stops the server with an error -- should we consider above as well?