-2

I need to communicate server1 to server2.
Server1 should have to fetch some records from Server2 when we execute program.exe will make server1 to fetch server2

When I gave netstat -an | find "server2" I Could see that some of the TCP ports are duplicating

TCP server1:6788    server2:2122    ESTABLISHED
TCP server1:6788    server2:1920    ESTABLISHED
TCP server1:6788    server2:1718    ESTABLISHED
TCP server1:6788    server2:1516    ESTABLISHED
TCP server1:6788    server2:1314    ESTABLISHED
TCP server1:6788    server2:1112    ESTABLISHED
TCP server1:6788    server2:8910    ESTABLISHED
TCP server1:6788    server2:5678    ESTABLISHED
TCP server1:6789    server2:1234    ESTABLISHED

"program.exe" gets up to 200 MB RAM allocated and is hanging, it will have 8 to 40 ports opened to Server2.

I am getting Error that

Transaction (Process ID 65) was deadlocked on lock resources with another process and has 
   been chosen as the deadlock victim. Rerun the transaction.
com.microsoft.sqlserver.jdbc.SQLServerException: Transaction (Process ID 65) was deadlocked 
  on lock resources with another process and has been chosen as the deadlock victim. 
  Rerun the transaction.

What should be the reason?

Is it because of less Memmory or This duplicated TCP Ports?

HBruijn
  • 72,524
  • 21
  • 127
  • 192
  • Those look more like connections from server2 to server1 listening on port 6788. See what is listening, `netstat -a -b | find "6788"` – Brian Oct 08 '14 at 14:23

1 Answers1

3

Transaction (Process ID 65) was deadlocked on lock resources

This is the problem... Also, the first 6 words of the error message. It's likely a race condition in your program's database access that results in the deadlock. It may also be a stale lock on the database; it's hard to tell. Queries that lock anything should be grouped in a transaction or at least set a timeout.


Edit: I thought I was being clear, but apparently not. The problem is in the way the program accesses the database, it has NOTHING to do with the TCP connections (at least not directly), they're a red herring.

Chris S
  • 77,337
  • 11
  • 120
  • 212