CPU hog - sockets

From: Prashanth (Prashanth_at_discussions.microsoft.com)
Date: 08/30/04


Date: Mon, 30 Aug 2004 05:51:05 -0700

Hi,
I'm in the middle of a mess!

Problem background:
I have a Windows services (running on XP) which acts as a client to a Java
server, uses TCP/IP sockets for communication. When this service starts, it
contacts the server and initializes a session key {Using PKI key exchange:
Java server has a public/private key pair (RSA 1024 bit). Client (Windows
service) receives the public key, generates a session key(3DES-192 bit I
think), encodes it using the public key, sends it across. Now onwards, this
key is used for encrypting the messages sent over plain socket connection.
Everytime, the client initiates a connection.}.

Problem:
After exchange of several encrypted messages correctly - say after some
100-200 exchanges, the Java server throws this exception:
ERROR 2004-08-30 16:31:26,359 com.abc.server.comm.SessionManager - Session
ID:5693931
javax.crypto.IllegalBlockSizeException: Input length (with padding) not
multiple of 8 bytes
        at com.xyz.crypto.provider.DESedeCipher.a(Unknown Source)
        at com.xyz.crypto.provider.DESedeCipher.engineDoFinal(Unknown Source)
        at com.xyz.crypto.provider.DESedeCipher.engineDoFinal(Unknown Source)
        at javax.crypto.Cipher.doFinal(Unknown Source)
        at com.abc.server.comm.SessionManager.encrypt(SessionManager.java:143)
        at com.abc.server.comm.Command.sendReply(Command.java:124)
        at
com.abc.server.comm.server.CommandDispatcher$1.run(CommandDispatcher.java:82)
        at
com.abc.server.threadpool.ThreadPoolInstance$PoolThread.run(ThreadPoolInstance.java:139)

After this, the client (windows service) hogs the CPU. Using process
explorer v7.01(sysinternals.com), I found that the thread trying to RECV
something through socket is going into this hogging, but as I am not an
expert in debugging, I couldnot pinpoint the place where this is happening.
Is there anyway to know using the debugger exctly what code is being run
during this hog? I could not map the thread I found out hogging the CPU using
process explorer to the threads I could list during debugging (WinDbg) as the
thread identifiers did not match. Moreover, when ever I start debugging with
WinDbg, the thread with main() is always the one to get a debug break (int
3). How can I identify and switch to the hogging thread, as the process
itself is waiting on debug break and the CPU is no more hogged once the
debugging starts?

I know this can be rated as a 'stupid' question, but please help me with this.



Relevant Pages

  • Re: Explanation of SSH
    ... I am still unclear on how SSH works exactly. ... Client issues SSH command and names server ... "Shopper" says "server sends back its public host and server keys ... Surely there is only one public key it sends ...
    (comp.security.ssh)
  • [NT] Dark Age of Camelot Man-In-The-Middle
    ... use of RSA public key cryptography and an RC4 based symmetric algorithm. ... Seeing the imminent release of code for cracking the game client (which ... At the beginning of each TCP session, the server sends a 1536 bit RSA ... void bytes_out(unsigned char *data, int len) ...
    (Securiteam)
  • Re: Debian SSH server configuration
    ... I would like to configure a Debian server to only allow clients to ssh ... I don't want any client computers to be able to ssh into ... It sounds like what you are asking for is host based authentication, ... where the server check to make sure that it has the host public key ...
    (Debian-User)
  • Re: Basics of key authentication
    ... The public key gets copied to the server, ... and the client decrypts it with its private key to prove he is who he ... and the digital signature to the server. ...
    (comp.security.ssh)
  • Re: What doesnt lend itself to OO?
    ... >> proxy and instructs the server to constuct the real object. ... rather than client code. ... If 'clock' is instantiated in the server, ... > for the server interface at the OOA level. ...
    (comp.object)