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

Backtrace from API query; post 81600 has no username #277

Closed
tripleee opened this issue Oct 31, 2017 · 7 comments
Closed

Backtrace from API query; post 81600 has no username #277

tripleee opened this issue Oct 31, 2017 · 7 comments

Comments

@tripleee
Copy link
Member

tripleee commented Oct 31, 2017

I have a code path from Halflife which crashes every time.

The traceback is a humongous pile of HTML which I am attaching here.

The request is

/api/posts/91435;91109;84856;83871;83119;83038;81600;81461;80727;79419

The beef of the error message seems to be in

Showing /var/railsapps/metasmoke/releases/20171031015321/app/views/posts/_post.json.jbuilder where line #7 raised:
    undefined method `username' for nil:NilClass
@tripleee
Copy link
Member Author

tripleee commented Oct 31, 2017

I managed to pare it down to a simpler test case which triggers on post 81600.

#!/usr/bin/env python

import json
import halflife

with open('halflife.conf') as conffile:
    conf = json.loads(conffile.read())
h = halflife.Halflife(conf['metasmoke-key'])
for idx in [91435, 91109, 84856, 83871, 83119, 83038, 81600, 81461, 80727, 79419]:
    try:
        print('# trying {0}'.format(idx))
        post = {'id': str(idx)}
        h.get_post_metainformation(post)
    except KeyboardInterrupt:
        break

I was speculating that the API filter expression in Halflife was causing this, but I get the traceback even without the filter.

@tripleee tripleee changed the title Backtrace from API query Backtrace from API query; post 81600 has no username Oct 31, 2017
@j-f1
Copy link
Contributor

j-f1 commented Oct 31, 2017

Seems like MS is complaining about nil.username' not working (&#39 is ').

Line 7 of _post.json.jbuilder is:

names: post.flag_logs.select { |f| f.success && f.is_auto }.map { |f| f.user.username },

So it looks like f.user is nil. I took a look at the flag logs page for this report, and sure enough, the first flag log doesn’t have a username in it.

@ArtOfCode-
Copy link
Member

bug buggity bug. Dunno why that doesn't have a user attached.

@tripleee
Copy link
Member Author

tripleee commented Nov 1, 2017

Another instance with the same symptom.

halflife:2017-11-01 05:49:18,598:Query posts/91541;89083;62604;62600;62596;62587;62571;62559;62543;62501 did not return valid JSON: '\n\n\n \n \n \n\n \n\n\n\n
\n
\n NoMethodError in\n API#posts\n
\n
\n\n
\n

\n Showing /var/railsapps/metasmoke/releases/20171031015321/app/views/posts/_post.json.jbuilder where line #7 raised:\n
\n

undefined method `username' for nil:NilClass

@tripleee
Copy link
Member Author

tripleee commented Nov 1, 2017

Using the repro script above, I isolated the offending sample: 62559

I don't really care about the user names so I suppose I could perhaps tweak the API query filter to not request this information as a workaround.

@tripleee
Copy link
Member Author

tripleee commented Nov 1, 2017

E.g. /flagging/users/2/logs returns a backtrace, too; I guess there are user IDs which used to exist but which are now deleted?

@ArtOfCode-
Copy link
Member

There certainly are some of those. Depending on what traceback you're getting, it may just be a 404.

@Undo1 Undo1 closed this as completed in 83f3a9f Nov 3, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants