libgit2sharp icon indicating copy to clipboard operation
libgit2sharp copied to clipboard

Exception when pushing to remote

Open kjnilsson opened this issue 11 years ago • 7 comments

I am getting the following exception when pushing to a running git daemon (with receive-pack enabled). the exception only occurs when the daemon is running on a separate machine, not when I run the deamon on the same machine as I am pushing to.

LibGit2Sharp.LibGit2SharpException: Error receiving socket data: An existing connection was forcibly closed by the remote host.

at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) at LibGit2Sharp.Core.Proxy.git_push_finish(PushSafeHandle push) at LibGit2Sharp.Network.Push(Remote remote, IEnumerable1 pushRefSpecs, PushOptions pushOptions, Signature signature, String logMessage) at LibGit2Sharp.Network.Push(Remote remote, String pushRefSpec, PushOptions pushOptions, Signature signature, String logMessage) at LibGit2Sharp.NetworkExtensions.Push(Network network, IEnumerable1 branches, PushOptions pushOptions)

the git daemon is run using this command: git daemon --base-path=. --enable=receive-pack --export-all --verbose

kjnilsson avatar Sep 12 '14 14:09 kjnilsson

What's the output from git-daemon? Can you get a dump of the network traffic between the client and the server?

carlosmn avatar Sep 12 '14 14:09 carlosmn

Hi,

Here is a wireshark dump: https://dl.dropboxusercontent.com/u/5434569/git_push_filtered.pcap

Entry 10 shows a Malformed Packet after which it appers the server sends a reset.

git daemon output:

$ git daemon --base-path=. --enable=receive-pack --export-all --verbose [332] Ready to rumble [4920] Connection from 10.1.9.84:53742 [4920] Extended attributes (27 bytes) exist <host=btn-ver-02.15b.local> [4920] Request receive-pack for '/blah'

Cheers Karl

kjnilsson avatar Sep 15 '14 10:09 kjnilsson

It looks like libgit2 is sending a no-op update. I can't recall offhand whether this is a protocol violation, but it's definitely a bug. Are both repositories you're testing against in the same state? How are you calling the push method?

carlosmn avatar Sep 15 '14 16:09 carlosmn

Yes both repos are in the same state. I am just using the Push method on Network repo.Network.Push(repo.Head)

kjnilsson avatar Sep 16 '14 08:09 kjnilsson

Is there anything I can do or provide to progress this issue?

Cheers Karl

kjnilsson avatar Oct 16 '14 15:10 kjnilsson

I'm having the same issue though it seems that the actual push was received...

deanshub avatar Feb 03 '16 08:02 deanshub

Hello, I have the same issue :(, in my case I run an internal tool that use LibGit2Sharp in a Teamcity Agent (which is a Windows Service).

14:04:42 Unhandled exception. LibGit2Sharp.LibGit2SharpException: error receiving data from socket: A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. 14:04:42 14:04:42 at LibGit2Sharp.Core.Ensure.HandleError(Int32 result) in /_/LibGit2Sharp/Core/Ensure.cs:line 154 14:04:42 at LibGit2Sharp.Core.Proxy.git_remote_connect(RemoteHandle remote, GitDirection direction, GitRemoteCallbacks& remoteCallbacks, GitProxyOptions& proxyOptions) in /_/LibGit2Sharp/Core/Proxy.cs:line 2172 14:04:42 at LibGit2Sharp.Repository.ListRemoteReferences(String url, CredentialsHandler credentialsProvider, ProxyOptions proxyOptions) in /_/LibGit2Sharp/Repository.cs:line 721 14:04:42 at ConfigApi.Services.GitLibSharpService.Clone(String repositoryPath, String repositoryUrl, String defaultBranchName) 14:04:42 at ConfigApi.Services.FusionService.MergeGITSourceBranchToTargetBranch(IGitLibSharpService gitLibSharpService, IBitbucketApiService bitbucketApiService, String targetRepositoryPath, Boolean isAutoMode, String localBranchName) 14:04:42 at ConfigApi.Services.FusionService.FusionAsync(FusionCommandSettings fusionCommandSettings, String fusionKey, ConsoleOutputMultiplexer logger, String sourceTenantName, String sourceJsonFilePath, String tempTenantName, String targetTenantName, Boolean isAutoMode, Boolean rollback, Boolean bypassOpenedPRCheck, Boolean bypassConfigObjectExtract, CancellationToken cancellationToken) 14:04:42 at ConfigApi.Program.<>c__DisplayClass0_1.<<Main>b__14>d.MoveNext() 14:04:42 --- End of stack trace from previous location --- 14:04:42 at McMaster.Extensions.CommandLineUtils.CommandLineApplication.ExecuteAsync(String[] args, CancellationToken cancellationToken) 14:04:42 at ConfigApi.Program.Main(String[] args) 14:04:42 at ConfigApi.Program.<Main>(String[] args)

If I run the tool on command line it works ...

Since the issue is still open after 11 years, I fear that it will never resolved :(

DomZZ avatar Jul 11 '25 12:07 DomZZ