db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "V.Narayanan (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-3454) 'java.lang.NullPointerException' is thrown when starting a master db before a slave one
Date Fri, 29 Feb 2008 09:08:51 GMT

     [ https://issues.apache.org/jira/browse/DERBY-3454?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

V.Narayanan updated DERBY-3454:
-------------------------------

    Attachment: Derby3454.stat
                Derby3454.diff

Pls find attached a patch. Below is a file by file explanation of the
patch attached.

M      java/engine/org/apache/derby/impl/services/replication/net/ReplicationMessageTransmit.java

* Introduced not null checks for sockConn in tearDown
* Introduced a method that throws an exception if sockConn is null and used it
  in the methods that send and receive messages.

M      java/engine/org/apache/derby/impl/services/replication/net/ReplicationMessageReceive.java

* The changes to this file are identical to changes done on ReplicationMessageTransmit
  except that I change some places where sockConn is called directly to send messages
  to use the sendMessage method instead.

M      java/engine/org/apache/derby/loc/messages.xml
M      java/shared/org/apache/derby/shared/common/reference/MessageId.java

* Introduced one Message for the IOException that is thrown upon SocketConnection object being
null

I ran the repro. Pls find the repro output below.

ij> connect 'jdbc:derby://localhost:1527/replicationdb';
ij> connect 'jdbc:derby://localhost:1527/replicationdb;startMaster=true;slaveHost=localhost;slavePort=8002';
ERROR XRE04: DERBY SQL error: SQLCODE: -1, SQLSTATE: XRE04, SQLERRMC: replicationdblocalhost8002XRE04
ij> connect 'jdbc:derby://localhost:1527/replicationdb;startMaster=true;slaveHost=localhost;slavePort=8003';
ERROR XRE04: DERBY SQL error: SQLCODE: -1, SQLSTATE: XRE04, SQLERRMC: replicationdblocalhost8002XRE04
ij> connect 'jdbc:derby://localhost:1527/replicationdb;startMaster=true;slaveHost=localhost;slavePort=8001';
ERROR XRE04: DERBY SQL error: SQLCODE: -1, SQLSTATE: XRE04, SQLERRMC: replicationdblocalhost8002XRE04
ij>

You don't see the null pointer exceptions any more.

8001 is the correct port. The connection with the correct port also fails because of Derby-3358.

> 'java.lang.NullPointerException' is thrown when starting a master db before a slave one
> ---------------------------------------------------------------------------------------
>
>                 Key: DERBY-3454
>                 URL: https://issues.apache.org/jira/browse/DERBY-3454
>             Project: Derby
>          Issue Type: Bug
>          Components: Replication
>    Affects Versions: 10.4.0.0
>            Reporter: Serge Tsv
>            Assignee: V.Narayanan
>         Attachments: Derby3454.diff, Derby3454.stat
>
>
> The 'java.lang.NullPointerException' exception is thrown when a database is started in
a master mode and is trying to establish a connection to an slave database socket, which is
not available.
> The exception is by the MasterController#startMaster(). First, it tries to setup connection
with a slave database using a transmitter:
>     MasterController#setupConnection
>        -> transmitter = new ReplicationMessageTransmit(); 
>             transmitter.initConnection()
>               -> new InetSocketAddress() -> createSocket() -> connect()
> The connect() method throws a ConnectException, and so fails to create a socketConn instance.
The exception is then wrapped several times an propagated back to the MasterController#startMaster()
method. It's caught there and then a MasterController#teardownNetwork() method is called,
which tries to send a STOP message using the aforementioned transmitter, which hasn't been
able to init a connection. 
> A transmitter simply tries to call socketConn.writeMessage(message), which throws NPE
because socketConn is null.
> Thanks!

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message