Skip to content

ZyanConnection: remoting channel registration race #86

Closed
@yallie

Description

@yallie

The code below contains a race condition (ZyanConnection,cs, line 200):

var registeredChannel = ChannelServices.GetChannel(_remotingChannel.ChannelName);

if (registeredChannel == null)
	ChannelServices.RegisterChannel(_remotingChannel, false);
else
	_remotingChannel = registeredChannel;

The race condition can affect the application startup if the application opens many connections in parallel.
Something like this:

var protocol = new AnyClientProtocolSetup(...);
ThreadPool.QueueUserWorkItem(x => CreateConnection(protocol, url1));
ThreadPool.QueueUserWorkItem(x => CreateConnection(protocol, url2));
ThreadPool.QueueUserWorkItem(x => CreateConnection(protocol, url3));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions