Hi Seven, Callback sounds good, but I'd say try things out as you think is best. Emmanuel has a point about the thread, so if you still can't replicate the problem before a fix start another with the patch (or attach to a JIRA, I suppose) and I'll apply and run it on my machine before you commit.
Cheers, Johnathan On Wed, 2011-09-28 at 10:29 +0200, Séven Le Mesle wrote: > Hi Johnathan, > > Ok I get it now :). > > So what about passing a CallBack to the start call so we can call it when > the loop is running. > This would be more compliant with the current API and the callback or > listener will be able to observe the loop lifecycle properly. > > The in the test we will be able to pass the CountDownLatch. > I see other nice features like restarting a failed loop. > > What you think about it ? Also tell me what you think about making the loop > a runnable and pushing it to an ExecutorService ? > > Séven. > > 2011/9/27 Johnathan Meehan <jmee...@phasevariance.com> > > > Hi, > > > > > I don't get exactly what you mean... > > > > I get that a lot. :) > > > > What I mean is that the countdown is hitting zero before the > > IOLoop#start() is even invoked. In this case, we're being returned to > > the caller (the test) whilst the setup (thread naming and flag set) is > > still ongoing. So, sometimes it fails as that thread's work just isn't > > finished. > > > > If I put text to the console when running the test, after "running" is > > set in IOLoop#start() and just before HttpServer#start(int) exits I see > > this: > > > > IOLoop: STARTED I/O-LOOP1 > > IOLoop: STARTED I/O-LOOP2 > > HttpServer: DONE > > IOLoop: STARTED I/O-LOOP3 > > > > What I thought was that we could pass the latch to the #start method > > (forgetting about what it breaks for now) and invoke #countdown when > > "running" has been set. Or, we could check for the state of the current > > IOLoop outside of the Thread created in the loop, and wait for it to be > > "running" before calling #countdown. Perhaps there's a more correct way > > of doing things, though. > > > > As the threads are started in a loop, I don't know if we need the call > > to #await either - we can simply drop out of the method after the loop > > has run. > > > > See the patch below - not a solution, but it will communicate better > > what I'm saying. :) > > > > Johnathan > > > > > > ### Eclipse Workspace Patch 1.0 > > #P deft > > Index: src/main/java/org/apache/deft/web/HttpServer.java > > =================================================================== > > --- src/main/java/org/apache/deft/web/HttpServer.java (revision 1176522) > > +++ src/main/java/org/apache/deft/web/HttpServer.java (working copy) > > @@ -113,16 +113,13 @@ > > @Override > > public void run() { > > registerHandler(ioLoop, protocol); > > - loopsLatch.countDown(); > > ioLoop.start(); > > } > > }).start(); > > + while(!ioLoop.isRunning()) { > > + } > > + loopsLatch.countDown(); > > } > > - try { > > - loopsLatch.await(); > > - } catch (InterruptedException e) { > > - logger.error("Interrupted while waiting for all IOLoop to > > start", e); > > - } > > } > > > > /** > > > > > > > > On Tue, 2011-09-27 at 14:15 +0200, Séven Le Mesle wrote: > > > Hi Johnathan, > > > > > > I don't get exactly what you mean but calling the countdown when the > > initial > > > setup is complete make's sense. > > > You can have a look on what I did to test multi-thread in HTTPServer. I > > > tried to make the start and stop calls blocking and returning only when > > > operation is done failed or successfull. > > > I'm not so happy with the implementation but it does work. > > > > > > We can imagine using a boolean flag in the calls to allow switching > > between > > > blocking and not blocking mode. > > > > > > Séven. > > > > > > 2011/9/27 Johnathan Meehan <jmee...@phasevariance.com> > > > > > > > > > > > Hi Seven, > > > > > > > > My machine has the same intermittent problem as the server. From what I > > > > see, the loop in IOLoop#start() is not always established quickly > > enough > > > > after #countdown has been invoked before it[1]. The last thread is > > > > always the one to fail the assertion, then. What about passing the > > > > CountdownLatch to a method with the appropriate signature, and calling > > > > #countdown when the inital setup is complete and the loop is actually > > > > running? > > > > > > > > Johnathan > > > > > > > > [1] > > > > loopsLatch.countDown() - Count: 2 > > > > start() - I/O-LOOP1 > > > > loopsLatch.countDown() - Count: 1 > > > > start() - I/O-LOOP2 > > > > LOOP: org.apache.deft.io.IOLoop@32955cd5 - true > > > > LOOP: org.apache.deft.io.IOLoop@68ed662d - true > > > > LOOP: org.apache.deft.io.IOLoop@3f9f3736 - false > > > > loopsLatch.countDown() - Count: 0 > > > > start() - I/O-LOOP3 > > > > > > > > > > > > On Tue, 2011-09-27 at 01:02 +0200, Séven Le Mesle wrote: > > > > > Great, so I'm not guilty this time cool. > > > > > The problem seems to appear every time on Solaris nodes, it might > > come > > > > from > > > > > server load ... > > > > > But we should fix this. > > > > > > > > > > 2011/9/27 Johnathan Meehan <jmee...@phasevariance.com> > > > > > > > > > > > > > > > > > I noticed on the build mailing list that somebody was talking about > > > > > > Jenkins being a little sluggish, but that seems to depend on the > > node > > > > > > being hit. Built okay this time on "ubuntu5" (that is, completed > > > > without > > > > > > errors). > > > > > > > > > > > > https://builds.apache.org/job/Deft/26/consoled > > > > > > > > > > > > > > > > > > On Tue, 2011-09-27 at 00:22 +0200, Séven Le Mesle wrote: > > > > > > > I don't believe in luckyness for such things. > > > > > > > But well we can hope for this time ... > > > > > > > So I'll ask Niklas directly to get Job administration rights. > > > > > > > > > > > > > > Thanks again for your great help. > > > > > > > > > > > > > > Séven > > > > > > > > > > > > > > 2011/9/27 Johnathan Meehan <jmee...@phasevariance.com> > > > > > > > > > > > > > > > > > > > > > > > That's done but the build is unstable as you remarked on > > earlier. > > > > It > > > > > > > > timed-out first time around whilst recording test results[1], > > so > > > > I'll > > > > > > > > start it again now and see what kind of luck we have. > > > > > > > > > > > > > > > > > I don't know how to get the rights, but that would be great. > > > > > > > > > > > > > > > > Niklas handled that for me, so perhaps you might ask him > > directly. > > > > > > > > > > > > > > > > [1] https://builds.apache.org/job/Deft/24/console > > > > > > > > > > > > > > > > > > > > > > > > On Mon, 2011-09-26 at 23:56 +0200, Séven Le Mesle wrote: > > > > > > > > > Hi Johnathan, > > > > > > > > > > > > > > > > > > yes you can update the Jenkins because I do not have the > > rights > > > > to > > > > > > update > > > > > > > > > it. > > > > > > > > > I don't know how to get the rights, but that would be great. > > > > > > > > > > > > > > > > > > Thanks for your help. > > > > > > > > > > > > > > > > > > Séven. > > > > > > > > > > > > > > > > > > 2011/9/26 Johnathan Meehan <jmee...@phasevariance.com> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > Hi Seven, > > > > > > > > > > > > > > > > > > > > The build was okay on my machine, and the examples seem to > > run > > > > > > > > correctly > > > > > > > > > > too. Do you have rights to update Jenkins? It didn't sound > > in > > > > your > > > > > > > > > > previous mail like you did, so let me know and I can change > > it > > > > for > > > > > > you. > > > > > > > > > > > > > > > > > > > > Johnathan > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > On Mon, 2011-09-26 at 23:35 +0200, Séven Le Mesle wrote: > > > > > > > > > > > Hy again, > > > > > > > > > > > > > > > > > > > > > > I just made the copy from sandbox to trunk all seems to > > be > > > > right. > > > > > > > > > > > Review needed :) > > > > > > > > > > > http://svn.apache.org/viewvc/incubator/deft/trunk/ > > > > > > > > > > > > > > > > > > > > > > Tell me, > > > > > > > > > > > > > > > > > > > > > > Séven > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > 2011/9/26 Séven Le Mesle <sleme...@xebia.fr> > > > > > > > > > > > > > > > > > > > > > > > Well it's mainly a copy of the branch to the Trunk or a > > > > merge > > > > > > if > > > > > > > > you > > > > > > > > > > prefer > > > > > > > > > > > > it. > > > > > > > > > > > > > > > > > > > > > > > > Don't forget to update Jenkins configuration though. > > > > > > > > > > > > > > > > > > > > > > > > Another question: > > > > > > > > > > > > After some commit, the DeftSystem test remains unstable > > > > while > > > > > > > > working > > > > > > > > > > on my > > > > > > > > > > > > mac :p. > > > > > > > > > > > > I suspect a Selector bug or so can someone reproduce > > the > > > > error > > > > > > of > > > > > > > > the > > > > > > > > > > > > Jenkins running on Solaris ? > > > > > > > > > > > > > > > > > > > > > > > > Thanks. > > > > > > > > > > > > > > > > > > > > > > > > Séven. > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > 2011/9/26 Roger Schildmeijer <schildmei...@gmail.com> > > > > > > > > > > > > > > > > > > > > > > > >> > > > > > > > > > > > >> On Sep 26, 2011, at 6:19 PM, Emmanuel Lecharny wrote: > > > > > > > > > > > >> > > > > > > > > > > > >> > On 9/26/11 6:03 PM, Niklas Gustavsson wrote: > > > > > > > > > > > >> >> On Mon, Sep 26, 2011 at 5:38 PM, Roger Schildmeijer > > > > > > > > > > > >> >> <schildmei...@gmail.com> wrote: > > > > > > > > > > > >> >>> Good question. I think we have fixed all the > > issues > > > > that > > > > > > were > > > > > > > > > > > >> "prerequisites" before we could leave the sandbox. > > Anyone > > > > > > > > disagree? > > > > > > > > > > > >> >> Go for it. > > > > > > > > > > > >> > just do it (tm) :) > > > > > > > > > > > >> > > > > > > > > > > > >> Anyone done it before and feel comfortable about doing > > it > > > > > > again :) > > > > > > > > ? > > > > > > > > > > > >> > > > > > > > > > > > >> > > > > > > > > > > > >> > > > > > > > > > > > > >> > > > > > > > > > > > > >> > -- > > > > > > > > > > > >> > Regards, > > > > > > > > > > > >> > Cordialement, > > > > > > > > > > > >> > Emmanuel Lécharny > > > > > > > > > > > >> > www.iktek.com > > > > > > > > > > > >> > > > > > > > > > > > > >> > > > > > > > > > > > >> > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > -- > > > > > > > > > > > > Séven Le Mesle > > > > > > > > > > > > Xebia IT Architects > > > > > > > > > > > > > > > > > > > > > > > > Email : sleme...@xebia.fr > > > > > > > > > > > > Mobile : +33(0)1 46 91 76 16 > > > > > > > > > > > > > > > > > > > > > > > > http://www.xebia.fr > > > > > > > > > > > > http://blog.xebia.fr > > > > > > > > > > > > > > > > > > > > > > > > Siège Social > > > > > > > > > > > > La Défense Colisée > > > > > > > > > > > > 10 / 12 Avenue de l'arche > > > > > > > > > > > > Faubourg de l'Arche > > > > > > > > > > > > 92419 Courbevoie Cedex > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > >