thrift-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "boxcppguy (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (THRIFT-4449) C# - TNamedPipeServerTransport.AcceptImpl can block indefinitely if TNamedPipeServerTransport.Close is called too quickly
Date Thu, 11 Jan 2018 01:03:10 GMT

     [ https://issues.apache.org/jira/browse/THRIFT-4449?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
]

boxcppguy updated THRIFT-4449:
------------------------------
    Description: 
What we observed is, when using the C# implementation TNamedPipeServerTransport along with
TSimpleServer, if you call TSimpleServer.Stop too quickly after TSimpleServer.Serve, the call
to evt.WaitOne in TNamedPipeServerTransport.AcceptImpl will block indefinitely because the
lambda passed into BeginWaitForConnection is never executed. We saw this in 0.9.3 but it's
suspected to be in 0.11.0 as well.

{noformat}
// in server wrapper class MyServer
this.serverThread = new Thread(() =>
{
    var processor = new MyProcessor();
    var transport = new TNamedPipeServerTransport("MyPipeName");
    var svr = new TSimpleServer(processor, transport);
    lock (this.serverLock)
    {
        this.server = svr;
    }

    svr.Serve();
})
{
    IsBackground = true
};

this.serverThread.Start();
{noformat}

{noformat}
// server wrapper class MyServer
protected virtual void Dispose(bool disposing)
{
    lock (this.serverLock)
    {
        try
        {
            if (this.server != null)
            {
                this.server.Stop();
            }

            if (this.serverThread != null)
            {
                this.serverThread.Join();
            }
        }
        finally
        {
            this.server = null;
            this.serverThread = null;
        }
    }
}
{noformat}

{noformat}
// test code
for (int i = 0; i < 100; ++i)
{
    using (var server = new MyServer())
    {
        server.Start();
    }
}
{noformat}

  was:
What we observed is, when using the C# implementation TNamedPipeServerTransport along with
TSimpleServer, if you call TSimpleServer.Stop too quickly after TSimpleServer.Serve, the call
to evt.WaitOne in TNamedPipeServerTransport.AcceptImpl will block indefinitely because the
lambda passed into BeginWaitForConnection is never executed. We saw this in 0.9.3 but it's
suspected to be in 0.11.0 as well.

{noformat}
// in server wrapper class MyServer
this.serverThread = new Thread(() =>
{
    var processor = new MyProcessor();
    var transport = new TNamedPipeServerTransportEx("MyPipeName");
    var svr = new TSimpleServer(processor, transport);
    lock (this.serverLock)
    {
        this.server = svr;
    }

    svr.Serve();
})
{
    IsBackground = true
};

this.serverThread.Start();
{noformat}

{noformat}
// server wrapper class MyServer
protected virtual void Dispose(bool disposing)
{
    lock (this.serverLock)
    {
        try
        {
            if (this.server != null)
            {
                this.server.Stop();
            }

            if (this.serverThread != null)
            {
                this.serverThread.Join();
            }
        }
        finally
        {
            this.server = null;
            this.serverThread = null;
        }
    }
}
{noformat}

{noformat}
// test code
for (int i = 0; i < 100; ++i)
{
    using (var server = new MyServer())
    {
        server.Start();
    }
}
{noformat}


> C# - TNamedPipeServerTransport.AcceptImpl can block indefinitely if TNamedPipeServerTransport.Close
is called too quickly
> -------------------------------------------------------------------------------------------------------------------------
>
>                 Key: THRIFT-4449
>                 URL: https://issues.apache.org/jira/browse/THRIFT-4449
>             Project: Thrift
>          Issue Type: Bug
>          Components: C# - Library
>    Affects Versions: 0.9.3
>         Environment: Windows 10.0.16299 64bit
>            Reporter: boxcppguy
>
> What we observed is, when using the C# implementation TNamedPipeServerTransport along
with TSimpleServer, if you call TSimpleServer.Stop too quickly after TSimpleServer.Serve,
the call to evt.WaitOne in TNamedPipeServerTransport.AcceptImpl will block indefinitely because
the lambda passed into BeginWaitForConnection is never executed. We saw this in 0.9.3 but
it's suspected to be in 0.11.0 as well.
> {noformat}
> // in server wrapper class MyServer
> this.serverThread = new Thread(() =>
> {
>     var processor = new MyProcessor();
>     var transport = new TNamedPipeServerTransport("MyPipeName");
>     var svr = new TSimpleServer(processor, transport);
>     lock (this.serverLock)
>     {
>         this.server = svr;
>     }
>     svr.Serve();
> })
> {
>     IsBackground = true
> };
> this.serverThread.Start();
> {noformat}
> {noformat}
> // server wrapper class MyServer
> protected virtual void Dispose(bool disposing)
> {
>     lock (this.serverLock)
>     {
>         try
>         {
>             if (this.server != null)
>             {
>                 this.server.Stop();
>             }
>             if (this.serverThread != null)
>             {
>                 this.serverThread.Join();
>             }
>         }
>         finally
>         {
>             this.server = null;
>             this.serverThread = null;
>         }
>     }
> }
> {noformat}
> {noformat}
> // test code
> for (int i = 0; i < 100; ++i)
> {
>     using (var server = new MyServer())
>     {
>         server.Start();
>     }
> }
> {noformat}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message