Bug 797880 - 'NaN' token in JSON response
Summary: 'NaN' token in JSON response
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Pulp
Classification: Retired
Component: user-experience
Version: 1.1.0
Hardware: Unspecified
OS: Unspecified
unspecified
high
Target Milestone: ---
: Sprint 34
Assignee: John Matthews
QA Contact: Preethi Thomas
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2012-02-27 12:01 UTC by Ivan Necas
Modified: 2013-09-09 16:35 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2012-05-25 14:15:44 UTC


Attachments (Terms of Use)
Part of bad response from Pulp repo sync status (8.00 KB, application/json)
2012-02-27 12:01 UTC, Ivan Necas
no flags Details

Description Ivan Necas 2012-02-27 12:01:00 UTC
Created attachment 566024 [details]
Part of bad response from Pulp repo sync status

Description of problem:
In some circumstances Pulp returns NaN in some fields in JSON response. This causes problems parsing this JSON, since it's not valid token.

Version-Release number of selected component (if applicable):
0.0.265-1

How reproducible:
Sometimes

Steps to Reproduce:
1. Synchronize remote repository
2. Perhaps some errors occur
3. Call api/repositories/repo_id/sync and parse it using a JSON parser

Actual results:
Sometimes error like this occurs (see attachment for a sample response):

unexpected token at 'NaN'

Expected results:
Pulp always returns valid JSON string.

Additional info:
This error causes Katello not being able to handle responses from Pulp

Comment 1 John Matthews 2012-04-17 17:48:53 UTC
Fix was to filter non integers from being passed into the ProgressTracker.
Added 2 tests to ProgressTracker
 1) for bad data of strings instead of ints
 2) explicit test for NaN being passed in

Fix was committed to Grinder's pulp_v1.1 branch.
http://git.fedorahosted.org/git/?p=grinder.git;a=commitdiff;h=af3f6a384a25960259b7f02b353483f0ab0407c9

Will be in grinder 0.0.147

Comment 2 Jeff Ortel 2012-04-19 15:44:36 UTC
build: 1.1.3

Comment 3 Preethi Thomas 2012-04-23 19:00:39 UTC
verified

[root@pulp-v1-1-server ~]#  curl -k -u admin:admin  https://localhost/pulp/api/repositories/local-1/sync/
[{"scheduled_time": null, "exception": "Cannot read from directory /root/local-repo", "traceback": ["Traceback (most recent call last):\n", "  File \"/usr/lib/python2.7/site-packages/pulp/server/tasking/task.py\", line 418, in run\n    result = self.callable(*self.args, **self.kwargs)\n", "  File \"/usr/lib/python2.7/site-packages/pulp/server/api/repo_sync.py\", line 283, in _sync\n    progress_callback, synchronizer, max_speed, threads)\n", "  File \"/usr/lib/python2.7/site-packages/pulp/server/api/repo_sync.py\", line 368, in fetch_content\n    progress_callback, max_speed, threads)\n", "  File \"/usr/lib/python2.7/site-packages/pulp/server/api/synchronizers.py\", line 164, in sync\n    max_speed=max_speed, threads=threads)\n", "  File \"/usr/lib/python2.7/site-packages/pulp/server/api/synchronizers.py\", line 1265, in local\n    self.init_progress_details(src_repo_dir, skip_dict)\n", "  File \"/usr/lib/python2.7/site-packages/pulp/server/api/synchronizers.py\", line 891, in init_progress_details\n    rpm_list = self.list_rpms(src_repo_dir)\n", "  File \"/usr/lib/python2.7/site-packages/pulp/server/api/synchronizers.py\", line 860, in list_rpms\n    pkglist = pulp.server.util.listdir(src_repo_dir)\n", "  File \"/usr/lib/python2.7/site-packages/pulp/server/util.py\", line 366, in listdir\n    raise Exception(\"Cannot read from directory %s\" % directory)\n", "Exception: Cannot read from directory /root/local-repo\n"], "job_id": null, "class_name": null, "start_time": "2012-04-23T15:01:03-04:00", "args": ["local-1"], "method_name": "_sync", "finish_time": "2012-04-23T15:01:03-04:00", "state": "error", "result": null, "scheduler": "immediate", "progress": null, "id": "ac2ca22b-8d76-11e1-9668-525400fbc951"}][root@pulp-v1-1-server ~]# 

[root@pulp-v1-1-server ~]# rpm -q grinder
grinder-0.0.147-1.fc16.noarch
[root@pulp-v1-1-server ~]#

Comment 4 Preethi Thomas 2012-05-25 14:15:44 UTC
Pulp v1.1 Release


Note You need to log in before you can comment on or make changes to this bug.