Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [Dltk-dev] can somebody explain to me the 2 IDbgpTermination and IDbgpTerminationListener

ok i found all the problems
Any objections that the DbgpTerminateOperation doesnt use a job but immediately calls stop (so yes in the even thread this time)
Because if you do it in a job and you just exit eclipse then that job doesnt have to be run at all yet
or the debug engine in eclipse is already terminated..

Also stop method of DLTKDebugPlugin:

public void stop(BundleContext context) throws Exception {
        HotCodeReplaceManager.getDefault().shutdown();

        super.stop(context);

        ILaunchManager launchManager = DebugPlugin.getDefault()
                .getLaunchManager();
        IDebugTarget[] targets = launchManager.getDebugTargets();
        for (int i = 0; i < targets.length; i++) {
            IDebugTarget target = targets[i];
            if (target instanceof ScriptDebugTarget) {
                ((ScriptDebugTarget) target).shutdown();
            }
        }

        if (dbgpService != null) {
            dbgpService.shutdown();
        }
    }

we first called shutdown on the service and then on the debug targets.

That seems to be the other way around because th debug targes depend on the service.

i cant currently commit that fix in the stop method because i have more changes in that class that i cant currently commit.
(remote debug support)
Can somebody else do it or else it will come later.

johan


On Wed, May 7, 2008 at 2:48 PM, Johan Compagner <jcompagner@xxxxxxxxx> wrote:
i am currently helped with this change in DbgpDebugingEngine:

    // IDbgpTerminataion
    public void requestTermination() {
        // always just close the socket

        try {
            socket.close();
        } catch (IOException e) {
            // TODO: log exception
            e.printStackTrace();
        }
    }

so no testing for a boolean and then never just close and cleanup the socket..
always just close it when requestTermination is called

But now if i have a debug connection open and i close eclipse i get this

!MESSAGE Internal error logged from DLTKDebugPlugin:
!STACK 0
org.eclipse.dltk.dbgp.exceptions.DbgpIOException: java.net.SocketException: Socket closed
    at org.eclipse.dltk.dbgp.internal.commands.DbgpDebuggingEngineCommunicator.communicate(DbgpDebuggingEngineCommunicator.java:68)
    at org.eclipse.dltk.dbgp.internal.commands.DbgpBaseCommands.communicate(DbgpBaseCommands.java:33)
    at org.eclipse.dltk.dbgp.internal.commands.DbgpContinuationCommands.execCommand(DbgpContinuationCommands.java:33)
    at org.eclipse.dltk.dbgp.internal.commands.DbgpContinuationCommands.stop(DbgpContinuationCommands.java:61)
    at org.eclipse.dltk.dbgp.internal.commands.DbgpCoreCommands.stop(DbgpCoreCommands.java:152)
    at org.eclipse.dltk.internal.debug.core.model.operations.DbgpTerminateOperation.process(DbgpTerminateOperation.java:23)
    at org.eclipse.dltk.internal.debug.core.model.operations.DbgpOperation$1.run(DbgpOperation.java:64)
    at org.eclipse.core.internal.jobs.Worker.run(Worker.java:55)
Caused by: java.net.SocketException: Socket closed
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:99)
    at java.net.SocketOutputStream.write(SocketOutputStream.java:136)
    at java.io.BufferedOutputStream.flushBuffer(BufferedOutputStream.java:65)
    at java.io.BufferedOutputStream.flush(BufferedOutputStream.java:123)
    at org.eclipse.dltk.dbgp.internal.packets.DbgpPacketSender.sendCommand(DbgpPacketSender.java:42)
    at org.eclipse.dltk.dbgp.internal.DbgpDebugingEngine.sendCommand(DbgpDebugingEngine.java:79)
    at org.eclipse.dltk.dbgp.internal.commands.DbgpDebuggingEngineCommunicator.sendRequest(DbgpDebuggingEngineCommunicator.java:30)
    at org.eclipse.dltk.dbgp.internal.commands.DbgpDebuggingEngineCommunicator.communicate(DbgpDebuggingEngineCommunicator.java:48)
    ... 7 more

so somehow the requestTermination already happened..
And then it still wants to send (i guess terminate command) to the other side...
i am investigation this now

johan



On Wed, May 7, 2008 at 2:27 PM, Andrey Platov <andrey@xxxxxxxxx> wrote:
Cool, just to clarify: if you do not have a time, will, or urgent need - Alex is willing to take care of this before end of May or something like that - no problems :)

----- Original Message -----
From: "Johan Compagner" <jcompagner@xxxxxxxxx>
To: "DLTK Developer Discussions" <dltk-dev@xxxxxxxxxxx>
Sent: Wednesday, May 7, 2008 7:23:03 PM GMT +06:00 Almaty, Novosibirsk
Subject: Re: [Dltk-dev] can somebody explain to me the 2 IDbgpTermination and IDbgpTerminationListener


hmmm
then i really need to dive in a bit more into that code.

Because everything is referencing everything and calling everything is it very hard to see for me directly what should do what ..
I will look if i can make head and tails of it and then try to figure out what the entry and exit points are

johan



On Wed, May 7, 2008 at 2:01 PM, Andrey Platov < andrey@xxxxxxxxx > wrote:


Also Johan, please feel free to rewrite this logic if you'd like.




----- Original Message -----
From: "Alex Panchenko" < alex@xxxxxxxxx >
To: "DLTK Developer Discussions" < dltk-dev@xxxxxxxxxxx >
Sent: Wednesday, May 7, 2008 5:43:38 PM GMT +06:00 Almaty, Novosibirsk
Subject: Re: [Dltk-dev] can somebody explain to me the 2 IDbgpTermination and IDbgpTerminationListener

Johan,

Yes, you are correct - all the "termination" logic looks strange.
We would like to fix it before 1.0 is released.

I believe we should move most of the logic into the DbgpTermination
class and simplify code its descendants.

Alex


Johan Compagner wrote:
> Because what method should exactly do what??
>
> for example we have the DbgpDebugingEngine
> that implements both
>
> IDbgpTerminationListener:
> void objectTerminated(Object object, Exception e);
>
>
> IDbgpTermination:
> void addTerminationListener(IDbgpTerminationListener listener);
>
> void removeTerminationListener(IDbgpTerminationListener listener);
>
> void requestTermination();
>
> void waitTerminated() throws InterruptedException;
>
>
> The problem is that in DbgpDebugingEngine
> the socket.close() is called in
>
> public void requestTermination() {
> synchronized (terminatedLock) {
> if (terminated) {
> return;
> }
> socket.close()
>
> But that boolean terminated is set in:
>
> public void objectTerminated(Object object, Exception e) {
> synchronized (terminatedLock) {
> if (terminated)
> return;
>
> receiver.removeTerminationListener(this);
> try {
> receiver.waitTerminated();
> } catch (InterruptedException e1) {
> // OK, interrupted
> }
>
> terminated = true;
> }
>
> and that is called before requestTermination() (at least in the
> situations i am in now)
> so socket.close() isnt called. So my debug client still thinks it is
> connected...
>
>
> So should socket.close() be called in objectTerminated()
> or should requestTermination not look at that terminated flag at all?
> because they are not really really related both are from different
> interfaces (behaviors)
>
> the simple fix i can think of is this:
>
> public void requestTermination() {
> try {
> socket.close();
> } catch (IOException e) {
> // TODO: log exception
> e.printStackTrace();
> }
> }
>
>
> But that code is a bit wired in each other that dont really know what
> is the head or what is the tail.... :(
>
> johan
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> dltk-dev mailing list
> dltk-dev@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/dltk-dev
>
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev


_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev
_______________________________________________
dltk-dev mailing list
dltk-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/dltk-dev



Back to the top