History | Log In     View a printable version of the current page.  
Issue Details (XML | Word | Printable)

Key: COR-691
Type: Bug Bug
Status: Closed Closed
Resolution: Fixed
Priority: Critical Critical
Assignee: Unassigned
Reporter: Dheeraj Guntupalli
Votes: 0
Watchers: 0
Operations

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

switchToFile() shared client failure

Created: 18/Jun/07 02:28 PM   Updated: 22/Aug/07 07:47 PM
Component/s: Client/Server
Affects Version/s: None
Fix Version/s: Denmark - v6.3

Time Tracking:
Original Estimate: 8h
Original Estimate - 8h
Remaining Estimate: 0h
Time Spent - 13h
Time Spent: 13h
Time Spent - 13h

File Attachments: 1. Java Source File Test.java (1 kb)
2. Zip Archive TestCase00001293.zip (346 kb)

Environment: db4o 6.1

Resolution Date: 22/Aug/07 07:47 PM
First Response Date: 18/Jun/07 09:23 PM
Labels:
Participants: Dheeraj Guntupalli, Neeraj Joshi and Patrick Roemer
Number of Attachments: 2
Number of Comments: 7


 Description  « Hide

Reported by client. Check https://na2.salesforce.com/50040000003Ghea

In client server mode, when we open client connection through switchToFile(sameFile) second time , the following Client Connection Error is displayed.

Client connection error
at com.db4o.internal.cs.ClientObjectContainer$1.retrieveMessage(Unknown Source)
at com.db4o.internal.cs.ClientObjectContainer$1.run(Unknown Source)
at com.db4o.foundation.Lock4.run(Unknown Source)
at com.db4o.internal.cs.ClientObjectContainer.getResponseMultiThreaded(Unknown Source)
at com.db4o.internal.cs.ClientObjectContainer.getResponse(Unknown Source)
at com.db4o.internal.cs.ClientObjectContainer.expectedResponse(Unknown Source)
at com.db4o.internal.cs.ClientObjectContainer.switchToFile(Unknown Source)
at Test.main(Test.java:27)

It works fine for 5.5. Attached the test case here.

 All   Comments   Work Log   Change History      Sort Order: Ascending order - Click to sort in descending order
Patrick Roemer - 18/Jun/07 09:23 PM
Reproducable against 6.3, too. What happens on the server side:

Msg.SWITCH_TO_FILE failed.
com.db4o.DatabaseFileLockedException: /home/patrick/workspaces/db4o/test/formula2.yap
at com.db4o.internal.JDK_1_4.lockFile(JDK_1_4.java:35)

IIRC file locking has been fixed to explicitly take care of VM-internal (or better: classloader-internal, as far as Java is concerned) locks through a dedicated map in JDK_1_4#lockFile(). This seems to "fire back" here. Will check whether there's just some unlock call missing or whether there is a bigger, conceptual issue.

Patrick Roemer - 19/Jun/07 12:39 AM
The file lock looks justified to me - the missing lock in 5.5 just covered the actual bug: Both clients would open db4o instances against the same file in this scenario. :/ Currently, ServerMessageDispatcherImpl#switchToFile() unconditionally opens a new ObjectContainer instance. Naive fix proposal: Keep a "global" map of files -> alive container instances (in ObjectServerImpl? along with their attached client/transaction count?), and grab a transaction from there if the file is already in use.

Neeraj Joshi - 20/Jun/07 01:03 PM
Exception occured using latest db4o-6.3.1.0 with latest testcase attached for .Net2.0
------------------------------------------------------------------------------------------------------------------
 'formula2.yap' closed
   at Db4objects.Db4o.Internal.CS.ClientObjectContainer.ExpectedResponse(Msg expectedMessage)
   at Db4objects.Db4o.Internal.CS.ClientObjectContainer.SwitchToFile(String fileName)
   at TestCase00001293.Program.Main(String[] args) in D:\SalesForce Cases\case00001293\TestCase00001293\Program.cs:line 32

Neeraj Joshi - 20/Jun/07 01:06 PM
Testcase for .Net2.0

Neeraj Joshi - 20/Jun/07 01:11 PM
Problem is reproducable against db4o-6.1.300.0, db4o-6.1.501.0 and db4o-6.2.101.0

Problem is not reproducable against db4o-6.1.1.0 (6.1.001) and db4o-6.0.200.0

Patrick Roemer - 29/Jun/07 01:24 PM
Fixed in svn trunk, pending concurrency review and decision whether to port back to 6.1.

Dheeraj Guntupalli - 10/Jul/07 09:47 AM
Where can we find the fixed version, to pass it on to the customer.