Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Algorithm negotiation fail #203

Closed
ajoberstar opened this issue Nov 2, 2017 · 16 comments
Closed

Algorithm negotiation fail #203

ajoberstar opened this issue Nov 2, 2017 · 16 comments

Comments

@ajoberstar
Copy link
Owner

Copied from ajoberstar/gradle-git-publish#42 by @daggerok

Hello,

I've upgraded '0.3.0' -> '0.4.0-rc.2', and now always getting 'Algorithm negotiation fail' error on gradle gitPublishPush task

build.gradle

plugins {
  id "base"
  id "org.asciidoctor.convert" version "1.5.3"
  id "org.ajoberstar.git-publish" version "0.4.0-rc.2"
  // // 0.3.0 version works fine
  // id "org.ajoberstar.git-publish" version "0.3.0"
}

asciidoctorj {
  version = "1.5.5"
}

asciidoctor {
  sourceDir = project.file("src")
  sources {
    include "index.adoc"
  }
  outputDir = project.file("$buildDir/asciidoc")
  attributes toc: "left",
      idprefix: "",
      docinfo1: "",
      icons: "font",
      idseparator: "-",
      setanchors: "true",
      "source-highlighter": "coderay",
      "toc-title": "Table of Contents",
      "build-gradle": file("build.gradle"),
      "endpoint-url": "https://daggerok.github.io/spring-data-examples"
}

gitPublish {
  repoUri = "[email protected]:daggerok/spring-data-examples.git"
  branch = "gh-pages"
  contents {
    from "$buildDir/asciidoc/html5"
    from "$projectDir/src/static"
    into "."
  }
}

asciidoctor.shouldRunAfter clean
build.dependsOn asciidoctor
gitPublishPush.dependsOn build
gitPublishPush.shouldRunAfter clean, build
task deploy(dependsOn: [gitPublishPush]) { shouldRunAfter build }

Note: adding to ~/.ssh/config doesn't helped:

KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha‌​1

As far as I can see, it's failing on gitPublishReset task

stacktrace

bash gradlew deploy -S

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':docs:gitPublishReset'.
> org.eclipse.jgit.api.errors.TransportException: [email protected]:daggerok/spring-data-examples.git: Algorithm negotiation fail

* Try:
Run with --info or --debug option to get more log output.

* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task ':docs:gitPublishReset'.
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:100)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.execute(ExecuteActionsTaskExecuter.java:70)
        at org.gradle.api.internal.tasks.execution.SkipUpToDateTaskExecuter.execute(SkipUpToDateTaskExecuter.java:62)
        at org.gradle.api.internal.tasks.execution.ResolveTaskOutputCachingStateExecuter.execute(ResolveTaskOutputCachingStateExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ValidatingTaskExecuter.execute(ValidatingTaskExecuter.java:58)
        at org.gradle.api.internal.tasks.execution.SkipEmptySourceFilesTaskExecuter.execute(SkipEmptySourceFilesTaskExecuter.java:97)
        at org.gradle.api.internal.tasks.execution.CleanupStaleOutputsExecuter.execute(CleanupStaleOutputsExecuter.java:87)
        at org.gradle.api.internal.tasks.execution.ResolveTaskArtifactStateTaskExecuter.execute(ResolveTaskArtifactStateTaskExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipTaskWithNoActionsExecuter.execute(SkipTaskWithNoActionsExecuter.java:52)
        at org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter.execute(SkipOnlyIfTaskExecuter.java:54)
        at org.gradle.api.internal.tasks.execution.ExecuteAtMostOnceTaskExecuter.execute(ExecuteAtMostOnceTaskExecuter.java:43)
        at org.gradle.api.internal.tasks.execution.CatchExceptionTaskExecuter.execute(CatchExceptionTaskExecuter.java:34)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker$1.run(DefaultTaskGraphExecuter.java:248)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:241)
        at org.gradle.execution.taskgraph.DefaultTaskGraphExecuter$EventFiringTaskWorker.execute(DefaultTaskGraphExecuter.java:230)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.processTask(DefaultTaskPlanExecutor.java:123)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.access$200(DefaultTaskPlanExecutor.java:79)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:104)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker$1.execute(DefaultTaskPlanExecutor.java:98)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.execute(DefaultTaskExecutionPlan.java:625)
        at org.gradle.execution.taskgraph.DefaultTaskExecutionPlan.executeWithTask(DefaultTaskExecutionPlan.java:580)
        at org.gradle.execution.taskgraph.DefaultTaskPlanExecutor$TaskExecutorWorker.run(DefaultTaskPlanExecutor.java:98)
        at org.gradle.internal.concurrent.ExecutorPolicy$CatchAndRecordFailures.onExecute(ExecutorPolicy.java:63)
        at org.gradle.internal.concurrent.ManagedExecutorImpl$1.run(ManagedExecutorImpl.java:46)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.gradle.internal.concurrent.ThreadFactoryImpl$ManagedThreadRunnable.run(ThreadFactoryImpl.java:55)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.gradle.internal.UncheckedException: org.eclipse.jgit.api.errors.TransportException: [email protected]:daggerok/spring-data-examples.git: Algorithm negotiation fail
        at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:63)
        at org.gradle.internal.UncheckedException.throwAsUncheckedException(UncheckedException.java:40)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:151)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:336)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor$RunnableBuildOperationWorker.execute(DefaultBuildOperationExecutor.java:328)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.execute(DefaultBuildOperationExecutor.java:199)
        at org.gradle.internal.progress.DefaultBuildOperationExecutor.run(DefaultBuildOperationExecutor.java:110)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeAction(ExecuteActionsTaskExecuter.java:110)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:92)
        ... 31 more
Caused by: org.eclipse.jgit.api.errors.TransportException: [email protected]:daggerok/spring-data-examples.git: Algorithm negotiation fail
        at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:222)
        at org.eclipse.jgit.api.LsRemoteCommand.call(LsRemoteCommand.java:160)
        at org.eclipse.jgit.api.LsRemoteCommand.call(LsRemoteCommand.java:74)
        at java_util_concurrent_Callable$call$0.call(Unknown Source)
        at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:48)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:113)
        at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:117)
        at org.ajoberstar.gradle.git.publish.GitPublishPlugin$_createResetTask_closure3$_closure9.doCall(GitPublishPlugin.groovy:82)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:93)
        at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
        at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:294)
        at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1022)
        at groovy.lang.Closure.call(Closure.java:414)
        at groovy.lang.Closure.call(Closure.java:430)
        at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:700)
        at org.gradle.api.internal.AbstractTask$ClosureTaskAction.execute(AbstractTask.java:673)
        at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter$1.run(ExecuteActionsTaskExecuter.java:121)
        ... 37 more
Caused by: org.eclipse.jgit.errors.TransportException: [email protected]:daggerok/spring-data-examples.git: Algorithm negotiation fail
        at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:163)
        at org.eclipse.jgit.transport.SshTransport.getSession(SshTransport.java:137)
        at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:274)
        at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:169)
        at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:199)
        ... 57 more
Caused by: com.jcraft.jsch.JSchException: Algorithm negotiation fail
        at com.jcraft.jsch.Session.receive_kexinit(Session.java:590)
        at com.jcraft.jsch.Session.connect(Session.java:320)
        at org.eclipse.jgit.transport.JschConfigSessionFactory.getSession(JschConfigSessionFactory.java:117)
        ... 61 more


* Get more help at https://help.gradle.org

BUILD FAILED in 5s

question: does anybody faced with such issue?
It would be nice if you can help me fix it
Thanks!


Regards,
Maksim

and follow up:

yesterday latest maximum worked version for me was: 0.3.0

unfortunately today I updated brew, and now I see another errors... I don't know if this is a reason, I think it could be depends on git updated or something like that...

gradle --debug for 0.3.0, error: 1024 - 0.3.0.log

Caused by: java.lang.ArrayIndexOutOfBoundsException: 1024
        at com.jcraft.jsch.agentproxy.Buffer.getByte(Buffer.java:142)
        at com.jcraft.jsch.agentproxy.Buffer.getShort(Buffer.java:138)
        at com.jcraft.jsch.agentproxy.Buffer.getInt(Buffer.java:123)
        at com.jcraft.jsch.agentproxy.Buffer.getString(Buffer.java:181)
        at com.jcraft.jsch.agentproxy.AgentProxy.getIdentities(AgentProxy.java:112)

I can provide logs for 0.3.2 as well, error: remote hung up unexpectedly - 0.3.2.log

Caused by: org.eclipse.jgit.errors.TransportException: [email protected]:daggerok/spring-data-examples.git: remote hung up unexpectedly
        at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:291)
        at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:169)
        at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:199)
        ... 58 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1024

and here is --debug logs for 0.4.0-rc.2, same error - 0.4.0-rc.2.log

Caused by: org.eclipse.jgit.errors.TransportException: [email protected]:daggerok/spring-data-examples.git: remote hung up unexpectedly
        at org.eclipse.jgit.transport.TransportGitSsh$SshFetchConnection.<init>(TransportGitSsh.java:291)
        at org.eclipse.jgit.transport.TransportGitSsh.openFetch(TransportGitSsh.java:169)
        at org.eclipse.jgit.api.LsRemoteCommand.execute(LsRemoteCommand.java:199)
        ... 58 more
Caused by: java.lang.ArrayIndexOutOfBoundsException: 1024

anyway, right now even previously worked configuration is not worked anymore..

gradleVersion = "4.3"

note: I google little bit, and tried fix with git config http.postBuffer 524288000, but it's doesn't helped too


Regards,
Maksim

@ajoberstar
Copy link
Owner Author

@daggerok This more recent issue could be: ymnk/jsch-agent-proxy#29

Unfortunately it seems that library isn't being maintained anymore, so not sure what to do about a fix.

The original issue, we'd have to reproduce again and get a debug log of to see if there's more information.

Side note, it didn't seem like the exceptions were showing up in the logs you posted. Did you redirect the error stream in as well?

@daggerok
Copy link

daggerok commented Nov 3, 2017

hm.. maybe I forgot redirect 2>&1...

gradle --debug asciidoctor gitPublishPush > 0.3.0-out.log 2> 0.3.0-err.log

gradle --debug asciidoctor gitPublishPush > 0.3.2-out.log 2> 0.3.2-err.log

gradle --debug asciidoctor gitPublishPush > 0.4.0-rc.2-out.log 2> 0.4.0-rc.2-err.log


regards

@ajoberstar
Copy link
Owner Author

Sorry, for the back and forth here, but looks like you'll need both --debug and --stacktrace on to get all of the info.

@daggerok
Copy link

daggerok commented Nov 3, 2017

@ajoberstar
Copy link
Owner Author

Yeah, this looks like that jsch-agent-proxy issue I linked above. Not sure what can be done about that though, there doesn't seem to be much info.

@daggerok
Copy link

daggerok commented Nov 4, 2017

sad...
thanks for your time, @ajoberstar

@gaborvass
Copy link

one solution is to update manually jsch files in .gradle/caches/modules-2/files-2.1/com.jcraft/jsch to version 0.1.54

@daggerok
Copy link

daggerok commented Mar 5, 2018

Not sure if it can help, but we can try force needed dependency like so:

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "org.ajoberstar:gradle-git-publish:0.4.0-rc.2"
  }
  configurations.all {
    resolutionStrategy {
      force 'com.jcraft:jsch:0.1.54'
    }
  }
}

apply plugin: "org.ajoberstar.git-publish"

at the moment I'm using old version which is only worked for me 0.2.2:

plugins {
  id "org.ajoberstar.git-publish" version "0.2.2"
}

Regards,
Maksim

@ajoberstar
Copy link
Owner Author

@gaborvass I definitely would suggest against modifying anything in the .gradle/caches.

@daggerok Yeah, that should work for forcing a version, though this may be fixed by using 0.3.3 publish plugin (which uses jsch 0.1.54, transitively). That 0.4.0-rc.2 version is a mistaken release from a while back. I'll have to see if there's way to remove it from the plugin portal.

@daggerok
Copy link

daggerok commented Mar 6, 2018

Hello, @ajoberstar

seems like root cause of problem is not with jsch 0.1.54 but something else...

I just have tried this:

buildscript {
  repositories {
    maven {
      url "https://plugins.gradle.org/m2/"
    }
  }
  dependencies {
    classpath "org.ajoberstar:gradle-git-publish:0.3.2"
  }
  configurations.all {
    resolutionStrategy {
      force "com.jcraft:jsch:0.1.54"
    }
  }
}

plugins {
  id "org.asciidoctor.convert" version "1.5.3"
}

apply plugin: "org.ajoberstar.git-publish"
// skip other stuff..

and wasn't successful, as well as using version 0.3.3

That 0.4.0-rc.2 version is a mistaken release from a while back. I'll have to see if there's way to remove it from the plugin portal.

yes you can ask remove it in this discussion: https://discuss.gradle.org/t/removing-an-accidentaly-published-plugin/11703

Update:
it's strange, don't know what basically dependencies are using, but gradle dependencies resolution tree for both versions (0.2.2 and 0.3.3) in my case is same:

./gradlew :docs:dependencies
# ...
asciidoctor
+--- org.asciidoctor:asciidoctorj:1.5.5
|    +--- org.jruby:jruby-complete:1.7.26
|    \--- com.beust:jcommander:1.35
\--- org.asciidoctor:asciidoctorj-groovy-dsl:1.0.0.preview2
     +--- org.codehaus.groovy:groovy-all:1.8.9
     \--- org.asciidoctor:asciidoctorj:1.5.1 -> 1.5.5 (*)

anyway, switching back to 0.2.2....


Regards,
Maksim

@daggerok
Copy link

daggerok commented Mar 6, 2018

OK,

I found another worked configuration, this time for 0.3.0 version:

buildscript {
  configurations.all {
    resolutionStrategy {
      force "com.jcraft:jsch:0.1.54"
    }
  }
}

plugins {
  id "org.ajoberstar.git-publish" version "0.3.0"
}

But not 0.3.2 nor 0.3.3 don't work. Hope this will help...


Regards,
Maksim

@ajoberstar
Copy link
Owner Author

The JSch stuff has been the cause of most of the issues over the history of grgit. I'm hoping that something like #206 will help here. It seems that JGit supports falling back to your system ssh or plink. I'm hoping that's more reliable.

@ajoberstar
Copy link
Owner Author

Closing, as the fix for #206, which will be the default in Grgit 3, should resolve this.

@douph1
Copy link

douph1 commented May 24, 2019

I was having the same issue with Jsch when I have env variable for an ssh-agent that I have killed

Caused by: java.lang.ArrayIndexOutOfBoundsException: 1024
at com.jcraft.jsch.agentproxy.Buffer.getByte(Buffer.java:142)
at com.jcraft.jsch.agentproxy.Buffer.getShort(Buffer.java:137)
at com.jcraft.jsch.agentproxy.Buffer.getInt(Buffer.java:123)
at com.jcraft.jsch.agentproxy.Buffer.getString(Buffer.java:181)
at com.jcraft.jsch.agentproxy.AgentProxy.getIdentities(AgentProxy.java:112)
at com.jcraft.jsch.agentproxy.RemoteIdentityRepository.getIdentities(RemoteIdentityRepository.java:47)
at com.jcraft.jsch.UserAuthPublicKey.start(UserAuthPublicKey.java:39)
at com.jcraft.jsch.Session.connect(Session.java:463)
at com.jcraft.jsch.Session.connect(Session.java:183)
at com.jcraft.jsch.Session$connect$1.call(Unknown Source)

Start another ssh-agent and set env var to new one solved the error
(maybe unset env var can do the trick too if ssh-agent is not needed anymore)

@ajoberstar
Copy link
Owner Author

What version of Grgit are you on? As of Grgit 3, I no longer include the JSch Agent Proxy. Most of the time you'll be using the native SSH on your machine rather than JSch.

@douph1
Copy link

douph1 commented May 24, 2019

None, sorry to comment on closed issue.
I just use Jsch and this issue is on top of google when searching for this pb exactly that I have encoured.
I just would like to give hint for jsch user as me who read this issue because this is not easy to find otherwise.
Thanks github to allow comment on closed issue :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants