Closed Bug 661617 Opened 14 years ago Closed 14 years ago

[traceback] AttributeError: 'NoneType' object has no attribute 'package'

Categories

(addons.mozilla.org Graveyard :: Add-on Builder, defect)

defect
Not set
critical

Tracking

(Not tracked)

RESOLVED FIXED
Builder 1.0

People

(Reporter: stephend, Assigned: zalun)

References

()

Details

https://builder-addons-next.allizom.org/addon/1000365/latest/ is returning a 500: Traceback (most recent call last): File "/data/amo_python/www/builder.next/flightdeck/vendor/lib/python/django/core/handlers/base.py", line 100, in get_response response = callback(request, *callback_args, **callback_kwargs) File "/data/amo_python/www/builder.next/flightdeck/apps/jetpack/views.py", line 99, in package_view_or_edit if revision.package.deleted: AttributeError: 'NoneType' object has no attribute 'package'
different than ObjectNotFound exception is raised. I've fixed it - waiting for the day to start in US to review changes. https://github.com/zalun/FlightDeck/commit/7286b797896e42f96993ad9b96ea5eac6c09e02a
Now https://builder-addons.allizom.org/addon/1004872/latest/ is bombing out with the same stack.
Severity: major → critical
Status: NEW → ASSIGNED
Target Milestone: --- → Builder 0.9.10
Assignee: nobody → zaloon
It happens when the Package item has no ``latest`` or ``version``. On Package creation both of these attributes are linked with the first PackageRevision. Code now leaves a critical log Package %s by %s has no latest or version revision
Status: ASSIGNED → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Although https://builder-addons.allizom.org/addon/1004872/latest/ is a 404, I ran Netsparker against trunk/dev, and didn't get any 500s. Verified FIXED.
Status: RESOLVED → VERIFIED
Re-opening: This traceback can be replicated by double-clicking the copy button from inside an add-on or library editor page. Perhaps this UI bug was the source of the original corrupt data.
Status: VERIFIED → REOPENED
Resolution: FIXED → ---
Target Milestone: Builder 0.9.10 → Builder 0.9.12
Target Milestone: Builder 0.9.12 → Builder 1.0
I can't replicate it on the localhost dev box. Let's try that: https://github.com/mozilla/FlightDeck/pull/85
The double-click raises a following exception: ``` File "/data/www/builder-addons-dev.allizom.org/flightdeck/apps/jetpack/models.py", line 1697, in copy new_p.latest.origin = self.latest AttributeError: 'NoneType' object has no attribute 'origin' ``` Although transaction decorator should roll back the changes in copy view, it would be good to prevent this from happening. new_p = Package( ... ) new_p.save() shouldn't result with new_p == None I've added a bit of logging: It's unclear to me. After doubleclick following lines do show a log: ``` if new_p: log.debug('[copy: %s] Package saved (%s)' % (self.pk, new_p. else: log.critical('[copy: %s] Package save(?) error' % self.pk) ``` ``` Dec 14 04:24:04 f.jetpack:DEBUG [copy: 18368] Package saved (None) :/data/www/builder-addons-dev.allizom.org/flightdeck/apps/jetpack/models.py:1699 [...] Dec 14 04:24:05 f.jetpack:DEBUG [copy: 18368] Package saved (29542) :/data/www/builder-addons-dev.allizom.org/flightdeck/apps/jetpack/models.py:1699 ``` And later certainly already known ``AttributeError: 'NoneType' object has no attribute 'origin'``
As ``new_p.pk == None``and ``new_p.latest`` is None it indicates that the save method failed
Back-end is not 100% fixed yet - dblclick can create 2 add-ons with the same name (run within transaction) We prevented dblclick in the JavaScript
Status: REOPENED → RESOLVED
Closed: 14 years ago14 years ago
Resolution: --- → FIXED
Best solution would be to add a unique constraint: UNIQUE KEY (name, author_id). This should stop the race conditions we're getting. However, we might have an issue trying to add a unique constraint since there are already some addon's that have managed to break this uniqueness (unintentionally). How do we determine which dupes to delete beforehand?
Product: addons.mozilla.org → addons.mozilla.org Graveyard
You need to log in before you can comment on or make changes to this bug.