Jump to content

P4 .NET API leaking connections

.NET C# leak

  • Please log in to reply
3 replies to this topic

#1 rpetrie



  • Members
  • Pip
  • 2 posts

Posted 30 September 2014 - 07:30 PM


I have a C# tool using the .NET API, and it consistently fails with WSAENOBUFS after a lot of operations. I can't find a way to clean up the resources used for any command except P4Command, which is IDisposable. For the commands I'm using (like Repository.GetChangelist or Client.EditFiles), they seem to use P4Command under the hood but don't clean up after themselves.

I know I can do some work to reduce the number of calls to the server, and I'll attack it from that route, but is there anything I can do short of rewriting my stuff in terms of P4Command to clean up the connections/resources being used?

#2 P4Shimada


    Advanced Member

  • Members
  • PipPipPip
  • 831 posts

Posted 30 September 2014 - 08:18 PM


Sorry to hear you are having connection resource issues.  To better trouble-shoot this issue, please let us know the following:

- What version of .NET are you using? (Any of the P4API.NET dll files, if you click on their properties it will show the version. For example in Windows Explorer if you select and right click the file 'p4api.net.dll' and select 'Properties' the 'Details' tab there is info for 'Product Name' and 'Product Version'.)

- What version of Visual Studio are you using (Help->About)?

- Are you using '$p4->Disconnect( );' after you connect and perform whichever actions?






#3 rpetrie



  • Members
  • Pip
  • 2 posts

Posted 01 October 2014 - 01:40 PM

p4api.net version: 2014.1.85.4506

Microsoft Visual Studio Premium 2012
Version 11.0.61030.00 Update 4
Microsoft .NET Framework
Version 4.5.50938

No, I'm not calling Disconnect() before the error occurs. Should I be disconnecting and reconnecting between every operation? That might solve my problem but doesn't sound particularly efficient.

#4 p4bill


    Advanced Member

  • Members
  • PipPipPip
  • 217 posts

Posted 01 October 2014 - 02:04 PM

I don't know that it is necessary to disconnect and reconnect between every operation.

Could you share some source that would show the problem?

How is your connection to the server? Local or Remote?

Also tagged with one or more of these keywords: .NET, C#, leak

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users