Bug 20245 - Socket.Disconnect throws exception "too many open files"
Summary: Socket.Disconnect throws exception "too many open files"
Alias: None
Product: Class Libraries
Classification: Mono
Component: System (show other bugs)
Version: 3.4.0
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2014-06-01 04:06 UTC by Sergey Zhukov
Modified: 2017-09-06 17:06 UTC (History)
3 users (show)

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


Description Sergey Zhukov 2014-06-01 04:06:33 UTC
If the user program does not properly disposes socket with Socket.Close, the exception "too many open files" can occur in Socket.Disconnect method, what is strange because this method does not allocate new socket.

TestCase: https://github.com/xplicit/HttpTestServer

ab -c 30 -n 10000 http://localhost:9001/

Sometimes exception can occurs in Socket.EndAccept method, what is expected behaviour, but in most cases you'll catch it in Socket.Disconnect.

Information about test case. This testcase emulates web-server. For each opened connection it sends "Hello, world!" http response. All the thing is done in NetworkConnector.Disconnect method https://github.com/xplicit/HttpTestServer/blob/master/NetworkConnector.cs#L327
Comment 1 Sergey Zhukov 2014-06-01 05:04:51 UTC
mono --version
Mono JIT compiler version 3.4.1 (master/5ed69a0 Wed May 28 06:31:59 NOVT 2014)
Copyright (C) 2002-2014 Novell, Inc, Xamarin Inc and Contributors. www.mono-project.com
	TLS:           __thread
	SIGSEGV:       altstack
	Notifications: epoll
	Architecture:  x86
	Disabled:      none
	Misc:          softdebug 
	LLVM:          supported, not enabled.
	GC:            sgen
Comment 2 Martin Baulig 2016-11-11 09:46:44 UTC
Closing ancient bugs, please reopen if you're still having this problem.
Comment 3 Sergey Zhukov 2016-11-11 10:29:17 UTC
The problem still exists it's easily reproduced with test-case is mentioned above and mono 4.6.1

Mono JIT compiler version 4.6.1 (Stable Wed Oct 12 09:10:37 UTC 2016)
OS: Ubuntu 16.04

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