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

When Alice (a fediverse actor) tries to follow a writefreely actor (Bob) and Alice already follows Bob then writefreely crashes. #159

Closed
qwazix opened this issue Aug 8, 2019 · 1 comment · Fixed by #166
Assignees
Labels
bug

Comments

@qwazix
Copy link
Collaborator

@qwazix qwazix commented Aug 8, 2019

Describe the bug

When a follow is already registered in the writefreely database, repeating the follow request crashes writefreely

Steps to reproduce (if necessary)

Steps to reproduce the behavior:

  1. Follow a writefreely author from an instance you control
  2. Fool your instance to think step 1 never happened (remove the follow from the database)
  3. Repeat 1
  4. Observe writefreely crash

Expected behavior

Nothing probably. Or maybe refresh the public key with the new one?

Application configuration

  • Single mode
  • sqlite [mysql/sqlite]
  • Open registration? no
  • Federation enabled? yes

Version or last commit: 0.10.0

log of installation, execution and crash with --debug

@qwazix qwazix changed the title When Alice (a fediverse actor) tries to follow a writefreely actor (Bob) and Alice already follows Bob then writefreely crashes. --- Aug 8, 2019
@qwazix qwazix changed the title --- When Alice (a fediverse actor) tries to follow a writefreely actor (Bob) and Alice already follows Bob then writefreely crashes. Aug 8, 2019
@thebaer thebaer added the bug label Aug 9, 2019
@robjloranger robjloranger self-assigned this Aug 9, 2019
@robjloranger

This comment has been minimized.

Copy link
Member

@robjloranger robjloranger commented Aug 9, 2019

So far I think I figured out the panic, there is an error check when inserting the new actor into the remote users table which previously only checked if the error was NOT for a duplicate key. So if there was a duplicate key it would just continue on trying to proceed, however the response from the db transaction is nil when there is an error, hence the panic.

I changed the check to check for any error and can now POST duplicate follow requests, only seeing an error logged that the key was not unique.

I will submit a PR and we can go from there.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.