1

プログラムで wireMockServer.stop() を呼び出すと、テストがこの無限のシャットダウン ループでスタックします。回避策として、これを静的にしましたが、テストごとにサーバーを新たに起動したいと思います。これを機能させる方法についてのアイデアはありますか?以下は、テストのコードと、wireMockServer.stop() が呼び出され、テストがこの無限ループに陥った後に表示されるログです。

public class StackOverflowApplicationTest extends ApplicationTestCase<MyApplication> {

    private WireMockServer wireMockServer;

    public StackOverflowTest() {
        super(MyApplication.class);
    }

    @Override
    protected void setUp() throws Exception {
        super.setUp();
        wireMockServer = new WireMockServer(8080);
        wireMockServer.start();
        createApplication();
    }

    @Override
    protected void tearDown() throws Exception {
        wireMockServer.stop();
        super.tearDown();
    }
}

12-08 19:27:12.125 7680-7733/? D/org.eclipse.jetty.io.IdleTimeout: SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,Open,in,out,R,-,29481/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1} idle timeout check, elapsed: 29481 ms, remaining: 519 ms
12-08 19:27:12.645 7680-7733/? D/org.eclipse.jetty.io.IdleTimeout: SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,Open,in,out,R,-,30001/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1} idle timeout check, elapsed: 30001 ms, remaining: -1 ms
12-08 19:27:12.646 7680-7733/? D/org.eclipse.jetty.io.IdleTimeout: SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,Open,in,out,R,-,30002/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1} idle timeout expired
12-08 19:27:12.646 7680-7733/? D/org.eclipse.jetty.io.WriteFlusher: ignored: WriteFlusher@1d5f8c29{IDLE} java.util.concurrent.TimeoutException: Idle timeout expired: 30001/30000 ms
12-08 19:27:12.647 7680-7712/? D/org.eclipse.jetty.io.AbstractConnection: FILL_INTERESTED-->IDLE FaultInjectingHttpConnection@3ff0341c[IDLE,SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,Open,in,out,-,-,30003/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1}][p=HttpParser{s=START,0 of -1},g=HttpGenerator{s=START},c=HttpChannelOverHttp@18f210ee{r=5,c=false,a=IDLE,uri=}]
12-08 19:27:12.647 7680-7733/? D/org.eclipse.jetty.io.AbstractEndPoint: Ignored idle endpoint SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,Open,in,out,-,-,30003/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1}
12-08 19:27:12.647 7680-7712/? D/org.eclipse.jetty.http.HttpParser: close HttpParser{s=START,0 of -1}
12-08 19:27:12.648 7680-7712/? D/org.eclipse.jetty.http.HttpParser: START --> CLOSED
12-08 19:27:12.648 7680-7712/? D/org.eclipse.jetty.io.AbstractConnection: FaultInjectingHttpConnection@3ff0341c[IDLE,SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,Open,in,out,-,-,1/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1}][p=HttpParser{s=CLOSED,0 of -1},g=HttpGenerator{s=START},c=HttpChannelOverHttp@18f210ee{r=5,c=false,a=IDLE,uri=}] onFillInterestedFailed java.util.concurrent.TimeoutException: Idle timeout expired: 30001/30000 ms
12-08 19:27:12.648 7680-7712/? D/org.eclipse.jetty.io.ChannelEndPoint: oshut SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,Open,in,out,-,-,1/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1}
12-08 19:27:12.649 7680-7712/? D/org.eclipse.jetty.io.AbstractConnection: fillInterested FaultInjectingHttpConnection@3ff0341c[IDLE,SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,Open,in,OSHUT,-,-,2/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1}][p=HttpParser{s=CLOSED,0 of -1},g=HttpGenerator{s=START},c=HttpChannelOverHttp@18f210ee{r=5,c=false,a=IDLE,uri=}]
12-08 19:27:12.649 7680-7712/? D/org.eclipse.jetty.io.AbstractConnection: IDLE-->FILL_INTERESTED FaultInjectingHttpConnection@3ff0341c[FILL_INTERESTED,SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,Open,in,OSHUT,-,-,2/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1}][p=HttpParser{s=CLOSED,0 of -1},g=HttpGenerator{s=START},c=HttpChannelOverHttp@18f210ee{r=5,c=false,a=IDLE,uri=}]
12-08 19:27:12.650 7680-7712/? D/org.eclipse.jetty.io.SelectChannelEndPoint: Ignoring local interests update 1 -> 1 for SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,Open,in,OSHUT,R,-,0/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1}
12-08 19:27:42.649 7680-7733/? D/org.eclipse.jetty.io.IdleTimeout: SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,Open,in,OSHUT,R,-,29999/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1} idle timeout check, elapsed: 29999 ms, remaining: 1 ms
12-08 19:27:42.651 7680-7733/? D/org.eclipse.jetty.io.IdleTimeout: SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,Open,in,OSHUT,R,-,30001/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1} idle timeout check, elapsed: 30001 ms, remaining: -1 ms
12-08 19:27:42.651 7680-7733/? D/org.eclipse.jetty.io.IdleTimeout: SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,Open,in,OSHUT,R,-,30001/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1} idle timeout expired
12-08 19:27:42.652 7680-7733/? D/org.eclipse.jetty.io.WriteFlusher: ignored: WriteFlusher@1d5f8c29{IDLE} java.util.concurrent.TimeoutException: Idle timeout expired: 30001/30000 ms
12-08 19:27:42.652 7680-7714/? D/org.eclipse.jetty.io.AbstractConnection: FILL_INTERESTED-->IDLE FaultInjectingHttpConnection@3ff0341c[IDLE,SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,Open,in,OSHUT,-,-,30002/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1}][p=HttpParser{s=CLOSED,0 of -1},g=HttpGenerator{s=START},c=HttpChannelOverHttp@18f210ee{r=5,c=false,a=IDLE,uri=}]
12-08 19:27:42.652 7680-7733/? D/org.eclipse.jetty.io.AbstractEndPoint: Ignored idle endpoint SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,Open,in,OSHUT,-,-,30002/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1}
12-08 19:27:42.652 7680-7714/? D/org.eclipse.jetty.http.HttpParser: close HttpParser{s=CLOSED,0 of -1}
12-08 19:27:42.653 7680-7714/? D/org.eclipse.jetty.http.HttpParser: CLOSED --> CLOSED
12-08 19:27:42.653 7680-7714/? D/org.eclipse.jetty.io.AbstractConnection: FaultInjectingHttpConnection@3ff0341c[IDLE,SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,Open,in,OSHUT,-,-,1/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1}][p=HttpParser{s=CLOSED,0 of -1},g=HttpGenerator{s=START},c=HttpChannelOverHttp@18f210ee{r=5,c=false,a=IDLE,uri=}] onFillInterestedFailed java.util.concurrent.TimeoutException: Idle timeout expired: 30001/30000 ms
12-08 19:27:42.654 7680-7714/? D/org.eclipse.jetty.io.AbstractEndPoint: onClose SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,CLOSED,in,OSHUT,-,-,2/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1}
12-08 19:27:42.654 7680-7714/? D/org.eclipse.jetty.io.ChannelEndPoint: close SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,CLOSED,in,OSHUT,-,-,2/30000,FaultInjectingHttpConnection}{io=1,kio=1,kro=1}
12-08 19:27:42.654 7680-7714/? D/org.eclipse.jetty.io.SelectorManager: Destroyed SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,CLOSED,ISHUT,OSHUT,-,-,2/30000,FaultInjectingHttpConnection}{io=1,kio=-1,kro=-1}
12-08 19:27:42.655 7680-7707/? D/org.eclipse.jetty.io.SelectorManager: Selector loop woken up from select, 0/0 selected
12-08 19:27:42.655 7680-7698/? W/art: Long monitor contention event with owner method=int libcore.io.Posix.poll(android.system.StructPollfd[], int) from Posix.java:4294967294 waiters=0 for 59.925s
12-08 19:27:42.655 7680-7698/? D/org.eclipse.jetty.util.component.AbstractLifeCycle: stopping org.eclipse.jetty.io.SelectorManager$ManagedSelector@21c47df5 keys=0 selected=0
12-08 19:27:42.655 7680-7714/? D/org.eclipse.jetty.io.AbstractConnection: onClose FaultInjectingHttpConnection@3ff0341c[IDLE,SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,CLOSED,ISHUT,OSHUT,-,-,3/30000,FaultInjectingHttpConnection}{io=1,kio=-1,kro=-1}][p=HttpParser{s=CLOSED,0 of -1},g=HttpGenerator{s=START},c=HttpChannelOverHttp@18f210ee{r=5,c=false,a=IDLE,uri=}]
12-08 19:27:42.655 7680-7707/? D/org.eclipse.jetty.io.SelectorManager: Selector loop waiting on select
12-08 19:27:42.656 7680-7698/? D/org.eclipse.jetty.io.SelectorManager: Stopping org.eclipse.jetty.io.SelectorManager$ManagedSelector@21c47df5 keys=0 selected=0
12-08 19:27:42.656 7680-7714/? D/org.eclipse.jetty.io.AbstractEndPoint: onClose SelectChannelEndPoint@1a478f0{/127.0.0.1:50741<->8080,CLOSED,ISHUT,OSHUT,-,-,4/30000,FaultInjectingHttpConnection}{io=1,kio=-1,kro=-1}
12-08 19:27:42.657 7680-7698/? D/org.eclipse.jetty.io.SelectorManager: Queued change org.eclipse.jetty.io.SelectorManager$ManagedSelector$Stop@b9ece89
12-08 19:27:42.657 7680-7707/? D/org.eclipse.jetty.io.SelectorManager: Selector loop woken up from select, 0/0 selected
12-08 19:27:42.657 7680-7707/? D/org.eclipse.jetty.io.SelectorManager: Running change org.eclipse.jetty.io.SelectorManager$ManagedSelector$Stop@b9ece89
12-08 19:27:42.658 7680-7698/? D/org.eclipse.jetty.io.SelectorManager: Stopped org.eclipse.jetty.io.SelectorManager$ManagedSelector@21c47df5 keys=-1 selected=-1
12-08 19:27:42.660 7680-7698/? D/org.eclipse.jetty.util.component.AbstractLifeCycle: STOPPED org.eclipse.jetty.io.SelectorManager$ManagedSelector@21c47df5 keys=-1 selected=-1
12-08 19:27:42.660 7680-7707/? D/org.eclipse.jetty.io.SelectorManager: Stopped Thread[qtp1052822663-321-selector-ServerConnectorManager@9d23a9b/0,5,main] on org.eclipse.jetty.io.SelectorManager$ManagedSelector@21c47df5 keys=-1 selected=-1

Jetty バージョン:

androidTestCompile "org.eclipse.jetty:jetty-server:9.2.14.v20151106"
androidTestCompile "org.eclipse.jetty:jetty-webapp:9.2.14.v20151106"
androidTestCompile "org.eclipse.jetty:jetty-servlet:9.2.14.v20151106"
androidTestCompile "org.eclipse.jetty:jetty-servlets:9.2.14.v20151106"
4

1 に答える 1

1

Jetty はグレースフル を試みているように見えますstop()。アクティブな接続と要求のすべてが最初に処理を終了するのを待ってから、stop().

ログには多くのTimeoutException発生が示されています。おそらくそれらを調べて、HTTP 交換を適切に (クライアント側とサーバー側の両方で) 処理していることを確認する必要があります。ログに基づいて、永続的な接続モードを確認します (使用している HTTP バージョンに注意してください)。これが最も可能性の高い原因です。

于 2015-12-09T18:12:02.817 に答える