D issues are now tracked on GitHub. This Bugzilla instance remains as a read-only archive.
Issue 15770 - SocketSet.add OutOfMemoryError on Posix
Summary: SocketSet.add OutOfMemoryError on Posix
Status: RESOLVED WORKSFORME
Alias: None
Product: D
Classification: Unclassified
Component: phobos (show other issues)
Version: D2
Hardware: x86_64 Linux
: P1 minor
Assignee: No Owner
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-03-06 07:16 UTC by Andre
Modified: 2017-07-10 22:31 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this issue.
Description Andre 2016-03-06 07:16:58 UTC
While adding a not alive socket to a SocketSet using method add() there is following error:

ERR core.exception.OutOfMemoryError@src/core/exception.d(679): Memory allocation failed

In some scenarios it is quite hard to find the root cause (not alive socket). An exception like InvalidSocket instead would be quite nice.

Tested on linux.
Comment 1 Vladimir Panteleev 2017-07-10 22:31:49 UTC
I can't reproduce this:

/////////////////////////// test.d //////////////////////////
import std.socket;

void main()
{
    auto ss = new SocketSet;
    auto s = new TcpSocket;
    ss.add(s);              // succeeds
    ss.add(TcpSocket.init); // segmentation fault as expected
}
/////////////////////////////////////////////////////////////

Please reopen if you can provide a reproducible test case.