Skip to content
This repository has been archived by the owner on Sep 7, 2022. It is now read-only.

Henchman sometimes fails with "unexpected end of JSON input" Error #95

Open
baskaran-md opened this issue Dec 2, 2015 · 16 comments
Open
Assignees

Comments

@baskaran-md
Copy link
Contributor

02:06:39 echo '{"cmd":"yum install -y edge-router --enablerepo=epel --nogpgcheck","loglevel":"debug"}' | /bin/bash -c 'sudo -H -u root ${HOME}/.henchman/shell'
02:06:53 unexpected end of JSON input

Not stacktrace /error log found!

@jlin21
Copy link
Contributor

jlin21 commented Dec 2, 2015

Is this being run with the latest release?

@jlin21
Copy link
Contributor

jlin21 commented Dec 2, 2015

Actually still fixing the latest release, something is up with the copy module

@jlin21
Copy link
Contributor

jlin21 commented Dec 2, 2015

should be ready to go now

@baskaran-md
Copy link
Contributor Author

00:04:17.471 
00:04:29.129 time="2015-12-03T02:27:50Z" level=error msg="Error running task 'Install Apigee RPM'" error="While in exec_module :: While unmarshalling task results :: unexpected end of JSON input" host=10.17.6.32 plan="Install Router" task="Install Apigee RPM" 

@jlin21
Copy link
Contributor

jlin21 commented Dec 7, 2015

The issue at hand is some of the data is being dropped from ssh.Exec. So if the output should return {"status": "changed", "msg": "hello world"} sometimes the output will be {"status": "changed", "msg": "hello. The second output will result in the JSON input error because it does not follow proper JSON. So the temp fix to this is to slap on "} to the end. This will result in incomplete outputs for the time being. The user will be notified when this occurs though.

@jlin21
Copy link
Contributor

jlin21 commented Dec 18, 2015

Notes:

  • I have tried removing concurrency in plan.go
  • Used ssh.go's methods in multiple ways including using stdoutPipe and what not

This could be an underlying issue with ssh.go

@baskaran-md
Copy link
Contributor Author

Any help on this? @madhurranjan / @sudharsh . This keeps happening and coulndt proceed with other tasks on playbook unless i have "ignore_errors: true" for that task.

@jlin21
Copy link
Contributor

jlin21 commented Dec 30, 2015

@baskaran-md Does temp fix prevent henchman from throwing "End of JSON Input error?". It should. If it does happen let me know please. We're still trying to find the root cause of that issues

@sudharsh sudharsh self-assigned this Jan 5, 2016
@sudharsh
Copy link
Contributor

sudharsh commented Jan 6, 2016

Have removed the explicit appending of '}' if this occurs as more log output is needed

@jlin21
Copy link
Contributor

jlin21 commented Jan 9, 2016

@sudharsh did you get a chance to test this yet?

sudharsh added a commit that referenced this issue Jan 11, 2016
This reverts commit 4d5f262.

Conflicts:
	henchman/task.go
sudharsh added a commit that referenced this issue Jan 11, 2016
madhurranjan pushed a commit that referenced this issue Jan 11, 2016
madhurranjan pushed a commit that referenced this issue Jan 12, 2016
@sudharsh
Copy link
Contributor

Here's what we know so far to be able reproduce this (1 in 3-5 times)

1.) The target node has to be,
* amazon-linux
No problems so far in others including centos 7.x, centos 6.5 and rhel 7.2
2.) Python version is 2.7.10
3.) There should be atleast one call to the Popen() constructor. Doesn't matter if this invocation is being used or is in the critical path. The moment a call to Popen() is made, things become unreliable.

@sudharsh sudharsh reopened this Jan 19, 2016
@sudharsh
Copy link
Contributor

fat-fingered 'Close and comment'

@sudharsh
Copy link
Contributor

Tried downgrading 2.7.10 to 2.7.5 on amazon linux. No dice.

@sudharsh
Copy link
Contributor

sudharsh commented Feb 9, 2016

Here's another clue, https://bugs.python.org/issue19612

@jlin21
Copy link
Contributor

jlin21 commented Feb 18, 2016

Issue resolved when shell module was ported to go

@jlin21 jlin21 closed this as completed Feb 18, 2016
@jlin21 jlin21 reopened this Feb 19, 2016
@jlin21
Copy link
Contributor

jlin21 commented Feb 22, 2016

go shell module will break at 1.4 mil length for output

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

No branches or pull requests

3 participants