Page 1 of 1

Error: JSON.parse

Posted: Fri Jun 07, 2019 9:04 am
by belegdae
Hey, I'm having an issue I'm struggling to find the cause of.
In the log, I have a large number of JSON parse errors for what I believe is the render info:

Code: Select all

3251: Error: JSON.parse:
3247: Unexpected token in JSON at position 1736

{
	"renders": [{
			"name": "d104-01",
			"id": 1,
			"priority": 99,
			"user_name": "rendf1",
			"time_register": 1559673925,
			"time_launch": 0,
			"time_update": 1559880938,
			"address": {
				"family": 4,
				"ip": "10.6.111.69",
				"port": 0
			},
			"netifs": [{
				"name": "{F1AF32D1-1100-4768-8836-33C3527FB08E}",
				"mac": "c8:d3:ff:be:83:ae",
				"addresses": [{
					"family": 4,
					"ip": "10.6.111.0",
					"port": 0
				}, {
					"family": 4,
					"ip": "10.6.111.69",
					"port": 0
				}, {
					"family": 4,
					"ip": "10.6.111.255",
					"port": 0
				}, {
					"family": 4,
					"ip": "224.0.0.0",
					"port": 0
				}, {
					"family": 4,
					"ip": "255.255.255.255",
					"port": 0
				}]
			}],
			"engine": "2.3.1",
			"st": 128,
			"state": " OFF WWK",
			"capacity_used": 0,
			"task_start_finish_time": 0,
			"wol_operation_time": 1559895464,
			"idle_time": 1559895464,
			"busy_time": 1559895464,
			"host": {
				"capacity": 1100,
				"max_tasks": 10,
				"power": 1000,
				"os": "windows 64",
				"nimby_idle_cpu": 10,
				"nimby_busy_cpu": 50,
				"nimby_idle_mem": 50,
				"nimby_busy_mem": 90,
				"nimby_idle_swp": 30,
				"nimby_busy_swp": 80,
				"nimby_idle_hddgb": 1,
				"nimby_busy_hddgb": 1,
				"nimby_idle_hddio": 50,
				"nimby_busy_hddio": 95
			}
		}, {
			"tasks_percents": [-1],
			"name": "d102-01",
			"id": 184,
			"priority": 99,
			"user_name": "rendf1",
			"time_register": 1559894602,
			"time_launch": 1559894712,
			"time_update": 1559895464,
			"address": {
				"family": 4,
				"ip": "10.6.111.34",
				"port": 0
			},
			"netifs": [{
				"name": "{54011075-23DC-402C-831C-1257798542CC}",
				"mac": "b4:b5:2f:e0:7a:cb",
				"addresses": [{
					"family": 4,
					"ip": "10.6.111.0",
					"port": 0
				}, {
					"family": 4,
					"ip": "10.6.111.34",
					"port": 0
				}, {
					"family": 4,
					"ip": "10.6.111.255",
					"port": 0
				}, {
					"family": 4,
					"ip": "224.0.0.0",
					"port": 0
				}, {
					"family": 4,
					"ip": "255.255.255.255",
					"port": 0
				}]
			}],
			"engine": "2.3.1",
			"st": 9,
			"state": " ONL RUN",
			"capacity_used": 1000,
			"task_start_finish_time": 1559895464,
			"wol_operation_time": 1559894712,
			"idle_time": 1559895464,
			"busy_time": 1559895419,
			"tasks": [{
					"name": " {
						"name": "d104-01",
						"id": 1,
						"pri",
						"service": "wakeonlan",
						"capacity": 1000,
						"time_start": 1559895464,
						"user_name": "d104-01",
						"block_name": "wake-on-lan",
						"job_name": "d104-01",
						"job_id": 1,
						"block_num": 1,
						"task_num": 0
					}], "host": {
					"capacity": 1100,
					"max_tasks": 10,
					"power": 1000,
					"os": "windows 64",
					"nimby_idle_cpu": 10,
					"nimby_busy_cpu": 50,
					"nimby_idle_mem": 50,
					"nimby_busy_mem": 90,
					"nimby_idle_swp": 30,
					"nimby_busy_swp": 80,
					"nimby_idle_hddgb": 1,
					"nimby_busy_hddgb": 1,
					"nimby_idle_hddio": 50,
					"nimby_busy_hddio": 95
				}
			}]
	}
After running it through a JSON validator it comes up with the following error lines:

Code: Select all

"name": "{ "

Code: Select all

"pri":,

Code: Select all

"task_num ": 0
}],
"host ": {
"capacity ": 1100,
and possibly a few others

I'm not sure if this is something I have broken in a configuration file, but it appears to be affecting all nodes.
Any ideas would be greatly appreciated!

Re: Error: JSON.parse

Posted: Fri Jun 07, 2019 9:47 am
by timurhai
Hi.
Some parts of a JSON were cut off.

Code: Select all

"tasks": [{
					"name": " {
						"name": "d104-01",
- in tasks list new render object started.

How did you got that JSON? Who reads it?

ps
There is no config option to make server to mix JSON parts.

pss
Better to write a useful signature like me.

Re: Error: JSON.parse

Posted: Fri Jun 07, 2019 10:42 am
by belegdae
Hi Timur,

It is printed into the WebGUI after triggering a Wake-on-Lan job from the web GUI, along with other WWK job machines erroring too.

It might be related, the wolwake job errors as follows:

Code: Select all

Fri 07 Jun 10:10.25 : Error task output:
=======================================================
['C:\\_PLUGINS\\CGRU\\utilities\\wolwake.py', '--wake', '--ip', '10.6.111.98', '--hostname', 'd104-07', 'c8d3ffbe99bc']
No mac address(es) specified.
Usage C:\_PLUGINS\CGRU\utilities\wolwake.py --(wake|sleep) --ip IP mac1 mac2 .. macN
MAC address(es) should be without any separators, just a string of 12 characters.
=======================================================
Fri 07 Jun 10:10.25 : #1: Automatically retrying error task4 of 9.: d104-07: "d104-07":
{
"name":"d104-07",
"id":13,
"priority":99,
"user_name":"rendf1",
"time_register":1559673925,
"time_launch":0,
"time_update":1559880941,
"address":{"family":4,"ip":"10.6.111.98","port":0},
"netifs":[
{"name":"{7F94C885-3EE9-4C00-A702-FC83280AAB5D}","mac":"c8:d3:ff:be:99:bc","addresses":[{"family":4,"ip":"10.6.111.0","port":0},{"family":4,"ip":"10.6.111.98","port":0},{"family":4,"ip":"10.6.111.255","port":0},{"family":4,"ip":"224.0.0.0","port":0},{"family":4,"ip":"255.255.255.255","port":0}]}
],
"engine":"2.3.1",
"st":384,
"state":" OFF WWK PAU",
"capacity_used":0,
"task_start_finish_time":0,
"wol_operation_time":1559898609,
"idle_time":1559898608,
"busy_time":1559898608,
"host":{
"capacity":1100,
"max_tasks":10,
"power":1000,
"os":"windows 64",
"nimby_idle_cpu":10,
"nimby_busy_cpu":50,
"nimby_idle_mem":50,
"nimby_busy_mem":90,
"nimby_idle_swp":30,
"nimby_busy_swp":80,
"nimby_idle_hddgb":1,
"nimby_busy_hddgb":1,
"nimby_idle_hddio":50,
"nimby_busy_hddio":95
}
Thanks again for all your help!

Re: Error: JSON.parse

Posted: Fri Jun 07, 2019 6:57 pm
by timurhai
What WEB browser are you using?
Anyway try some other one, this error happens?

Re: Error: JSON.parse

Posted: Fri Jun 07, 2019 7:02 pm
by timurhai
Just read your signature..
300 windows clients on a windows server!!!
I bet that you are the first who did it!
For a such amount of clients i want to recommend Linux server.
If you can run soft Linux - it is definitely better to use Linux on clients too.
Linux is much more better for networks.
( You can work on Windows and use Linux farm, such way is widely used, Afanasy has paths map mechanisms )

Re: Error: JSON.parse

Posted: Sat Jun 08, 2019 8:41 am
by belegdae
Hey Timur,

I've recorded a video of what happens in various browsers:
https://i.imgur.com/du3Nnhh.mp4

Shown in the video is Chrome, Internet Explorer and Firefox.

Other commands like reboot, launch command appear to work fine with "action processed"

We're a univeristy, and our layout is 400 workstations without dedicated farm machines.
The workstations go Nimby on login, and free on logoff. I don't have any control over the OS's used sadly!

Re: Error: JSON.parse

Posted: Mon Jun 10, 2019 9:18 am
by timurhai
Hi.
Ok! I will check it. Looks like a bug on server.

Also, you can try afwatch (Qt GUI) - it is much faster, may be better on a big amount of clients.
And you can try Linux for afserver only.

Re: Error: JSON.parse

Posted: Mon Jun 10, 2019 8:34 pm
by timurhai
Hi.
I reproduced the same bug on Linux server with a Linux client.
So OS does not matter here.
Will dig it deeper.

Re: Error: JSON.parse

Posted: Tue Jun 11, 2019 9:02 am
by timurhai
Hi.

Yes it is a bug in afserver:
https://github.com/CGRU/cgru/blob/maste ... ob.cpp#L54
If task name is not specified, we can't just use a beginning of a command for it, as command can contain JSON data with a special characters.
So now, we can fix it.

Were have you got an afserver binary?
From a release archive?
Can you compile it yourself?

btw
This bug can't hung an afserver or a GUI, may be you can simple ignore it? Or it bothers you much?

Re: Error: JSON.parse

Posted: Tue Jun 11, 2019 11:30 am
by belegdae
Hey Timur,

Binaries from sourceforge:
http://sourceforge.net/projects/cgru/fi ... p/download

It's not an essential feature for me, I just wanted to make sure it wasn't having other unexpected effects!

I've not compiled before, but not afraid to look into it! Thank you!