Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[Dltk-dev] Re: The timeout in the DbgpDebuggingEngineCommunicator.communicate()

The strange thing is the first time when you start the timeout will become 0 in this code:

while (!terminated && !map.containsKey(key)) {
                if (timeout != 0 && timeout < MIN_TIMEOUT) {
                    break;
                }
                long begin = System.currentTimeMillis();

                wait(timeout);

                long delta = System.currentTimeMillis() - begin;
                if (timeout != 0) {
                    timeout -= delta;
                }
            }


I guess because there are no events coming in that dont apply to that given key.
that map will only contain the first time that key.
So first it waits for the max timout
the the delta will be the same as the timeout and the timout will be then 0
and then it will wait for ever

When i debug it when it comes out the timout is something like 28.
But that is a timeout of nothing and that will result in that the delta will be bigger then that (depending on how fast your pc is i guess)
then the timeout becomes less then 0.

So i guess it is completely random what really happens.. It depends on how fast your pc is and how busy
if the delta is exactly the timeout then it will wait indefinitely but if somehow that isnt the case then the next time it will timeout..

i guess the better code would be this:

            long endTime = 0;
            if (timeout > 0) {
                endTime = System.currentTimeMillis() + timeout;
            }
            while (!terminated && !map.containsKey(key)) {
                long current = System.currentTimeMillis();
                if (endTime != 0 && current >= endTime) {
                    break;
                }
                if (endTime == 0)
                    wait();
                else
                    wait(endTime - current);
            }

 Then it really waits for ever if timeout == 0
else it will wait until the endTime which is current time + timeout.

The problem is that this still doesnt fix my problem :)
Can i make a preference of that timeout? That i can then set in my plugin_customization.ini?

johan




On Thu, Jul 3, 2008 at 1:33 PM, Johan Compagner <jcompagner@xxxxxxxxx> wrote:
Hi,

DbgpDebuggingEngineCommunicator.communicate() calls this method:


    private DbgpResponsePacket receiveResponse(int transactionId)
            throws IOException, InterruptedException {
        return engine.getResponsePacket(transactionId, TIMEOUT);
    }

there a timeout is given to the engine of 500 seconds i think.

The problem is that i dont want a timeout or if there is a time it i want Integer.MAX_VALUE.

This is because if i debug a method and then press Resume in the debugger
a DbgpContinuationCommand (RUN_COMMAND) is done.
That one just keeps waiting for the next event to arrive.

That can be again a suspend one.
But if a user doesnt do anything (drinks a cup of coffee) for 10 minutes then bang the timeout occurs
after that everything is in an invalid state...

Because if the user now triggers an method in the client. Then the clients hangs because the clients send something
to the debugger but the debugger never reads that anymore.

So everything hangs.

I really want to wait forever on it or until the client somehow shutdown..
How can we make this configurable?

johan
 



Back to the top