Bug 32332 - Segmentation fault when calling NamedPipeServerStream.Disconnect()
Summary: Segmentation fault when calling NamedPipeServerStream.Disconnect()
Status: NEW
Alias: None
Product: Runtime
Classification: Mono
Component: General (show other bugs)
Version: 2.10.x
Hardware: PC Linux
: --- normal
Target Milestone: ---
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2015-07-22 16:04 UTC by jacques
Modified: 2017-08-28 15:02 UTC (History)
2 users (show)

See Also:
Tags:
Is this bug a regression?: ---
Last known good build:


Attachments

Description jacques 2015-07-22 16:04:38 UTC
Getting the following on Fedora 22 with mono 2.10.8.0

Using the dmcs compiler.

When disconnecting a namedpipe connection I  get a segfault.


Running code like the following:

NamedPipeServerStream pipeClientConnection = new NamedPipeServerStream(pipeName, PipeDirection.In);
_inputStream = new StreamReader(pipeClientConnection);
_pipeServer = new Task(() =>
{
    while (true)
    {
        pipeClientConnection.WaitForConnection();
        Console.WriteLine("Report from pipe: " + _inputStream.ReadLine());
        pipeClientConnection.Disconnect(); // Commenting this line out fixes the problem
    }
});
...
_pipeServer.Start();

This opens the unix socket fine, but when I echo some text into the socket I get:

Opening Pipe
Opened, any key to exit
Report from pipe: kaythanksbye
Stacktrace:


Native stacktrace:

	mono() [0x49e695]
	mono() [0x4f09bb]
	mono() [0x421fdd]
	/lib64/libpthread.so.0(+0x10430) [0x7fa88e685430]
	/lib64/libc.so.6(fclose+0x4) [0x7fa88e10b754]
	[0x402702ab]

Debug info from gdb:


=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries 
used by your application.
=================================================================

If I remove the Disconnect() line (marked as a comment), I no longer get a crash.

Note You need to log in before you can comment on or make changes to this bug.