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

[Investigation] Uncaught exception in distributions_controller.pickedup #3557

Closed
2 tasks
cielf opened this issue Apr 23, 2023 · 15 comments · Fixed by #3740
Closed
2 tasks

[Investigation] Uncaught exception in distributions_controller.pickedup #3557

cielf opened this issue Apr 23, 2023 · 15 comments · Fixed by #3740
Assignees
Labels
core team Groomed but likely needs expert knowledge

Comments

@cielf
Copy link
Collaborator

cielf commented Apr 23, 2023

Summary

Unable to complete distributions sometimes. There's something strange going on. Find out what!

Requires bugsnag access to investigate, so limiting to more senior folk.

Details

Example

From bugsnag, April 13, 2023, User 466 and similarly about a week earlier, User 14

ActiveRecord::RecordInvaliddistributions#picked_up
Validation failed: Inventory Donated Diapers (Size 4) is not available at this storage location
User 466

Failing at line 202 in distributions_controller.rb
if !distribution.complete? && distribution.complete!

Notes:

The first time we noticed this, it was with a kit that had been deactivated.
This time, it is with an item that does not appear on the storage location.
However, Donated Diapers (Size 4) is missing from what appears to be the main storage location for the bank, when Donated Diapers (Size 3) and Donated Diapers (Size 5) are both there. This does not seen right. How could this happen?
It seems to die silently rather than giving a 500 error - at least with the most recent case.

This may be related to the bugsnag we've with "undefined method "lower than on hand minimum quantity".

Criteria for completion

  • figure out why the item disappeared from the storage location
  • report back / make new proto-issue / put in a PR as appropriate
@cielf cielf added the core team Groomed but likely needs expert knowledge label Apr 23, 2023
@cielf
Copy link
Collaborator Author

cielf commented May 24, 2023

This hasn't happened since May 13th. On May 11th it happened several times and also on May 5. All the ones in the last month are one user, and it looks like all one item throwing the error. Now, this particular user does have a history of jamming the save button, so it might be related to that. I also wonder if they might just be trying to change the storage location on complete?

@cielf cielf self-assigned this May 24, 2023
@cielf
Copy link
Collaborator Author

cielf commented May 24, 2023

They only have one storage location, so that's a dead end

@cielf
Copy link
Collaborator Author

cielf commented May 24, 2023

It looks like the inventory on May 13 for the item was "N/A" .

@cielf
Copy link
Collaborator Author

cielf commented May 24, 2023

It appears that the partner was able to request the item even though there had never been any inventory. Is that something we should be blocking?

@cielf
Copy link
Collaborator Author

cielf commented May 24, 2023

(I suppose some banks will do purchases based on what is requested, so probably not to block)

@cielf
Copy link
Collaborator Author

cielf commented May 26, 2023

But how were they able to save it the distribution with the item with no inventory?

@github-actions
Copy link
Contributor

github-actions bot commented Jun 6, 2023

This issue has been inactive for 246 hours (10.25 days) and will be automatically unassigned after 114 more hours (4.75 days).

@cielf
Copy link
Collaborator Author

cielf commented Jun 6, 2023

This has not recurred since the double-click issue was fixed. I suggest we wait another 2 weeks, and if it hasn't recurred, we consider it a side-effect of that.

@github-actions
Copy link
Contributor

This issue has been inactive for 262 hours (10.92 days) and will be automatically unassigned after 98 more hours (4.08 days).

@cielf
Copy link
Collaborator Author

cielf commented Jun 18, 2023

Closing. We think it might have been a side effect of the double-click issue.

@cielf cielf closed this as completed Jun 18, 2023
@cielf
Copy link
Collaborator Author

cielf commented Jun 29, 2023

It's BAAACK!!! See bugsnag

@cielf cielf reopened this Jun 29, 2023
@cielf
Copy link
Collaborator Author

cielf commented Jun 30, 2023

Picking up again... What this has in common with the "lower than on hand minimum quality" error (which has a separate investigation)... is that there is a storage location involved that does not have and inventory entry. That the item is not available at this storage location. How does that happen? In this case, it existed once upon a time...

@cielf
Copy link
Collaborator Author

cielf commented Jun 30, 2023

There is a "remove empty items" in storage_location.rb. Which is called in update_storage_location, which is called in the call on ItemizableUpdateService .

So -- whenever we update an itemizable, we are checking if the storage location has no inventory for that (at the end, I think, but double-check), and removing the inventory_item if it has a level of 0.

Then, when we look for it at pickup, or if changing the storage location, we are scuppered.

I suspect this was done to keep the list of items you can pick from to just the ones that you can actually distribute (could be wrong on that).

@cielf
Copy link
Collaborator Author

cielf commented Jul 1, 2023

I'm not sure, though, where we should be handling this -- when we look at it, or just not removing the inventory item.

@cielf
Copy link
Collaborator Author

cielf commented Jul 6, 2023

It has some other effects, too. If you don't have any of the item in your storage location, then you change the storage location to a different one, then change it back, you get a problem as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core team Groomed but likely needs expert knowledge
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant