File upload creates files multiple times

Hi, it seems I’ve encountered a bug:

In the card view when uploading files, they are created multiple times. Not only that, but checking the other cards I noticed that the multiplied attachment was also added to other cards. It doesn’t happen everytime though, and I haven’t been able to figure out a pattern yet. But when it happens instead of the upload being instantaneous a little upload bar appears and then once it’s done the file is uploaded multiple times like in the screenshot.

I’m not discounting the possibility that I’ve made a configuration error when installing but I’ve used the Docker + Traefik 2 template and I don’t see what I could’ve done wrong to create such an oddity. It’s a fresh installation of v0.19.2.

Update:
I was able to find one pattern: As I mentioned the files are also sometimes copied to other cards. Specifically it seems that they were copied to all cards in the same column that came before the card I was uploading to. And most cards contained two copies of the multiplied file.

Update2:
I was able to reproduce this on Vikunja Try. It seems that it only occurs when Drag&Dropping files onto the card. I didn’t experience the issue when first clicking on “Add attachments” and the using the file picker via “Upload Attachment”

Are you using database caching?

I don’t think so, I used your docker template for Vikunja+Traefik and apart from not being sure how to make sure that the Traefik container and the Vikunja container are on the same Docker network I didn’t run into any problems.

This is my docker-compose.yml

version: '3'

services:
  api:
    image: vikunja/api
    environment:
      VIKUNJA_DATABASE_HOST: db
      VIKUNJA_DATABASE_PASSWORD: -REDACTED-
      VIKUNJA_DATABASE_TYPE: mysql
      VIKUNJA_DATABASE_USER: vikunja
      VIKUNJA_DATABASE_DATABASE: vikunja
      VIKUNJA_SERVICE_JWTSECRET: -REDACTED-
      VIKUNJA_SERVICE_FRONTENDURL: https://subdomain.domain.de/
      VIKUNJA_SERVICE_ENABLEEMAILREMINDERS: 1
      VIKUNJA_MAILER_ENABLED: 1
      VIKUNJA_MAILER_FROMEMAIL: -REDACTED-
      VIKUNJA_MAILER_HOST: -REDACTED-
      VIKUNJA_MAILER_PORT: 587
      VIKUNJA_MAILER_USERNAME: -REDACTED-
      VIKUNJA_MAILER_PASSWORD: -REDACTED-
    volumes:
      - ./files:/app/vikunja/files
    networks:
      - web
      - default
    depends_on:
      - db
    restart: unless-stopped
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.vikunja-api.rule=Host(`subdomain.domain.de`) && PathPrefix(`/api/v1`, `/dav/`, `/.well-known/`)"
      - "traefik.http.routers.vikunja-api.entrypoints=websecure"
      - "traefik.http.routers.vikunja-api.tls.certResolver=myresolver"
      - "traefik.docker.network=web"
  frontend:
    image: vikunja/frontend
    labels:
      - "traefik.enable=true"
      - "traefik.http.routers.vikunja-frontend.rule=Host(`subdomain.domain.de`)"
      - "traefik.http.routers.vikunja-frontend.entrypoints=websecure"
      - "traefik.http.routers.vikunja-frontend.tls.certResolver=myresolver"
      - "traefik.docker.network=web"
    networks:
      - web
      - default
    restart: unless-stopped
  db:
    image: mariadb:10
    command: --character-set-server=utf8mb4 --collation-server=utf8mb4_unicode_ci
    environment:
      MYSQL_ROOT_PASSWORD: -REDACTED-
      MYSQL_USER: vikunja
      MYSQL_PASSWORD: -REDACTED-
      MYSQL_DATABASE: vikunja
    volumes:
      - ./db:/var/lib/mysql
    restart: unless-stopped
    command: --max-connections=1000

And I was able to reproduce this on the “Try Vikunja” demo instance

A gif of what it looks like, when it happens (on the Vikunja Try instance):

Vikunja_upload

I should mention that in this example the file wasn’t actually present as many times as entries appear in the gif: after a refresh of the page it was attached 5 times.

Can you check in the db (task_attachments table) if e attachment was actually uploaded multiple times or if that’s just a display issue?

I’ve tried getting a dump on my instance with

docker container exec -it <container id> /app/vikunja/vikunja dump

but the dump failed with

2022/09/17 21:38:57 No config file found, using default or config from environment variables.
2022-09-17T21:38:57.222079436Z: INFO    ▶ migration/Migrate 04d Ran all migrations successfully.
2022-09-17T21:38:57.223045565Z: INFO    ▶ dump/Dump 04f Start dumping config file...
2022-09-17T21:38:57.224087505Z: WARNING ▶ dump/Dump 054 No config file found, not including one in the dump. This usually happens when environment variables are used for configuration.
2022-09-17T21:38:57.224778287Z: INFO    ▶ dump/Dump 055 Dumped config file
2022-09-17T21:38:57.225524669Z: INFO    ▶ dump/Dump 056 Dumped .env file
2022-09-17T21:38:57.226085513Z: INFO    ▶ dump/Dump 057 Start dumping version file...
2022-09-17T21:38:57.226893875Z: INFO    ▶ dump/Dump 058 Dumped version
2022-09-17T21:38:57.227526918Z: INFO    ▶ dump/Dump 059 Start dumping database...
2022-09-17T21:38:57.223715289Z: INFO    ▶ [EVENTS] 053 Adding handler, handler_name=poison.logger, topic=poison
2022-09-17T21:38:57.229114062Z: INFO    ▶ [EVENTS] 05b Adding handler, handler_name=task.comment.edited.handle.task.comment.edit.mentions, topic=task.comment.edited
2022-09-17T21:38:57.2302609Z: INFO      ▶ [EVENTS] 05c Adding handler, handler_name=namespace.deleted.namespace.counter.decrease, topic=namespace.deleted
2022-09-17T21:38:57.231198469Z: INFO    ▶ [EVENTS] 05e Adding handler, topic=team.member.added, handler_name=team.member.added.team.member.added.notification
2022-09-17T21:38:57.232414507Z: INFO    ▶ [EVENTS] 05f Adding handler, handler_name=namespace.created.namespace.counter.increase, topic=namespace.created
2022-09-17T21:38:57.233137449Z: INFO    ▶ [EVENTS] 061 Adding handler, handler_name=list.deleted.list.counter.decrease, topic=list.deleted
2022-09-17T21:38:57.233669203Z: INFO    ▶ [EVENTS] 062 Adding handler, handler_name=task.created.task.counter.increase, topic=task.created
2022-09-17T21:38:57.234189178Z: INFO    ▶ [EVENTS] 063 Adding handler, handler_name=task.created.task.created.mentions, topic=task.created
2022-09-17T21:38:57.234923341Z: INFO    ▶ [EVENTS] 064 Adding handler, handler_name=task.updated.task.updated.mentions, topic=task.updated
2022-09-17T21:38:57.235651662Z: INFO    ▶ [EVENTS] 065 Adding handler, handler_name=user.export.requested.handle.user.data.export, topic=user.export.requested
2022-09-17T21:38:57.236478474Z: INFO    ▶ [EVENTS] 067 Adding handler, handler_name=list.created.list.counter.increase, topic=list.created
2022-09-17T21:38:57.237546383Z: INFO    ▶ [EVENTS] 068 Adding handler, handler_name=list.created.send.list.created.notification, topic=list.created
2022-09-17T21:38:57.238353594Z: INFO    ▶ [EVENTS] 06a Adding handler, handler_name=team.deleted.team.counter.decrease, topic=team.deleted
2022-09-17T21:38:57.239163336Z: INFO    ▶ [EVENTS] 06b Adding handler, handler_name=team.created.team.counter.increase, topic=team.created
2022-09-17T21:38:57.239818368Z: INFO    ▶ [EVENTS] 06c Adding handler, handler_name=task.comment.created.task.comment.notification.send, topic=task.comment.created
2022-09-17T21:38:57.2405946Z: INFO      ▶ [EVENTS] 06d Adding handler, handler_name=task.assignee.created.task.assigned.notification.send, topic=task.assignee.created
2022-09-17T21:38:57.241381362Z: INFO    ▶ [EVENTS] 06e Adding handler, handler_name=task.assignee.created.task.assignee.subscribe, topic=task.assignee.created
2022-09-17T21:38:57.242175684Z: INFO    ▶ [EVENTS] 06f Adding handler, topic=user.created, handler_name=user.created.increase.user.counter
2022-09-17T21:38:57.243321082Z: INFO    ▶ [EVENTS] 071 Adding handler, handler_name=task.deleted.task.counter.decrease, topic=task.deleted
2022-09-17T21:38:57.244228092Z: INFO    ▶ [EVENTS] 072 Adding handler, handler_name=task.deleted.task.deleted.notification.send, topic=task.deleted
2022-09-17T21:38:57.245785825Z: INFO    ▶ [EVENTS] 089 Starting handler, subscriber_name=task.comment.edited.handle.task.comment.edit.mentions, topic=task.comment.edited
2022-09-17T21:38:57.246161942Z: INFO    ▶ [EVENTS] 08a Starting handler, subscriber_name=user.created.increase.user.counter, topic=user.created
2022-09-17T21:38:57.246174852Z: INFO    ▶ [EVENTS] 08b Starting handler, subscriber_name=task.deleted.task.deleted.notification.send, topic=task.deleted
2022-09-17T21:38:57.246182282Z: INFO    ▶ [EVENTS] 08c Starting handler, topic=list.created, subscriber_name=list.created.list.counter.increase
2022-09-17T21:38:57.246189472Z: INFO    ▶ [EVENTS] 08d Starting handler, topic=task.assignee.created, subscriber_name=task.assignee.created.task.assignee.subscribe
2022-09-17T21:38:57.246196871Z: INFO    ▶ [EVENTS] 08e Starting handler, subscriber_name=list.deleted.list.counter.decrease, topic=list.deleted
2022-09-17T21:38:57.246203591Z: INFO    ▶ [EVENTS] 08f Starting handler, topic=task.created, subscriber_name=task.created.task.counter.increase
2022-09-17T21:38:57.246210111Z: INFO    ▶ [EVENTS] 090 Starting handler, subscriber_name=task.created.task.created.mentions, topic=task.created
2022-09-17T21:38:57.246225491Z: INFO    ▶ [EVENTS] 091 Starting handler, subscriber_name=namespace.created.namespace.counter.increase, topic=namespace.created
2022-09-17T21:38:57.246238791Z: INFO    ▶ [EVENTS] 092 Starting handler, topic=user.export.requested, subscriber_name=user.export.requested.handle.user.data.export
2022-09-17T21:38:57.246250441Z: INFO    ▶ [EVENTS] 093 Starting handler, subscriber_name=list.created.send.list.created.notification, topic=list.created
2022-09-17T21:38:57.246256681Z: INFO    ▶ [EVENTS] 094 Starting handler, subscriber_name=task.updated.task.updated.mentions, topic=task.updated
2022-09-17T21:38:57.24626335Z: INFO     ▶ [EVENTS] 095 Starting handler, topic=team.deleted, subscriber_name=team.deleted.team.counter.decrease
2022-09-17T21:38:57.24627502Z: INFO     ▶ [EVENTS] 096 Starting handler, topic=team.created, subscriber_name=team.created.team.counter.increase
2022-09-17T21:38:57.24628841Z: INFO     ▶ [EVENTS] 097 Starting handler, subscriber_name=task.comment.created.task.comment.notification.send, topic=task.comment.created
2022-09-17T21:38:57.24630519Z: INFO     ▶ [EVENTS] 098 Starting handler, subscriber_name=task.assignee.created.task.assigned.notification.send, topic=task.assignee.created
2022-09-17T21:38:57.24631274Z: INFO     ▶ [EVENTS] 099 Starting handler, subscriber_name=poison.logger, topic=poison
2022-09-17T21:38:57.246347959Z: INFO    ▶ [EVENTS] 09a Starting handler, subscriber_name=namespace.deleted.namespace.counter.decrease, topic=namespace.deleted
2022-09-17T21:38:57.24636134Z: INFO     ▶ [EVENTS] 09b Starting handler, subscriber_name=team.member.added.team.member.added.notification, topic=team.member.added
2022-09-17T21:38:57.2463708Z: INFO      ▶ [EVENTS] 09c Starting handler, subscriber_name=task.deleted.task.counter.decrease, topic=task.deleted
2022-09-17T21:38:57.303048991Z: INFO    ▶ dump/Dump 0f0 Dumped database
2022-09-17T21:38:57.30412237Z: INFO     ▶ dump/Dump 0f1 Start dumping files...
2022-09-17T21:38:57.306408765Z: CRITICAL        ▶ cmd/func2 11b error saving file: open files/1: no such file or directory

Is that because there are files that are references but can’t be found?

After that didn’t work I tried to access the table directly in the vikunja_db docker container:

Database state before trying to get duplicates for testing:

MariaDB [vikunja]> select * from task_attachments;
+-----+---------+---------+---------------+---------------------+
| id  | task_id | file_id | created_by_id | created             |
+-----+---------+---------+---------------+---------------------+
|  73 |      33 |      77 |             1 | 2022-09-11 17:17:25 |
|  74 |      34 |      78 |             1 | 2022-09-11 17:17:25 |
|  75 |      35 |      79 |             1 | 2022-09-11 17:17:25 |
|  76 |      36 |      80 |             1 | 2022-09-11 17:17:25 |
|  77 |      37 |      81 |             1 | 2022-09-11 17:17:25 |
|  78 |      38 |      82 |             1 | 2022-09-11 17:17:25 |
|  79 |      39 |      83 |             1 | 2022-09-11 17:17:25 |
|  80 |      39 |      84 |             1 | 2022-09-11 17:17:25 |
|  81 |      40 |      85 |             1 | 2022-09-11 17:17:25 |
|  82 |      41 |      86 |             1 | 2022-09-11 17:17:25 |
|  83 |      42 |      87 |             1 | 2022-09-11 17:17:25 |
|  84 |      43 |      88 |             1 | 2022-09-11 17:17:25 |
|  85 |      44 |      89 |             1 | 2022-09-11 17:17:25 |
|  86 |      44 |      90 |             1 | 2022-09-11 17:17:25 |
|  87 |      46 |      91 |             1 | 2022-09-11 17:17:25 |
|  88 |      47 |      92 |             1 | 2022-09-11 17:17:25 |
|  89 |      47 |      93 |             1 | 2022-09-11 17:17:25 |
|  90 |      48 |      94 |             1 | 2022-09-11 17:17:25 |
|  91 |      49 |      95 |             1 | 2022-09-11 17:17:25 |
|  92 |      50 |      96 |             1 | 2022-09-11 17:17:25 |
|  93 |      51 |      97 |             1 | 2022-09-11 17:17:25 |
|  94 |      52 |      98 |             1 | 2022-09-11 17:17:25 |
|  95 |      53 |      99 |             1 | 2022-09-11 17:17:25 |
|  96 |      54 |     100 |             1 | 2022-09-11 17:17:25 |
|  97 |      55 |     101 |             1 | 2022-09-11 17:17:25 |
|  98 |      56 |     102 |             1 | 2022-09-11 17:17:25 |
|  99 |      57 |     103 |             1 | 2022-09-11 17:17:25 |
| 102 |      45 |     106 |             1 | 2022-09-11 17:17:25 |
| 103 |      58 |     107 |             1 | 2022-09-11 17:17:25 |
| 104 |      59 |     108 |             1 | 2022-09-11 17:17:25 |
| 105 |      60 |     109 |             1 | 2022-09-11 17:17:25 |
| 106 |      61 |     110 |             1 | 2022-09-11 17:17:25 |
| 107 |      62 |     111 |             1 | 2022-09-11 17:17:25 |
| 108 |      63 |     112 |             1 | 2022-09-11 17:17:25 |
| 109 |      64 |     113 |             1 | 2022-09-11 17:17:25 |
+-----+---------+---------+---------------+---------------------+
35 rows in set (0.000 sec)

A few times it worked correctly even with Drag&Drop and I deleted the attachment again. Then the duplication occurred and the file was shown twice in the attachments.

Checking the database afterwards:

MariaDB [vikunja]> select * from task_attachments;
+-----+---------+---------+---------------+---------------------+
| id  | task_id | file_id | created_by_id | created             |
+-----+---------+---------+---------------+---------------------+
|  73 |      33 |      77 |             1 | 2022-09-11 17:17:25 |
|  74 |      34 |      78 |             1 | 2022-09-11 17:17:25 |
|  75 |      35 |      79 |             1 | 2022-09-11 17:17:25 |
|  76 |      36 |      80 |             1 | 2022-09-11 17:17:25 |
|  77 |      37 |      81 |             1 | 2022-09-11 17:17:25 |
|  78 |      38 |      82 |             1 | 2022-09-11 17:17:25 |
|  79 |      39 |      83 |             1 | 2022-09-11 17:17:25 |
|  80 |      39 |      84 |             1 | 2022-09-11 17:17:25 |
|  81 |      40 |      85 |             1 | 2022-09-11 17:17:25 |
|  82 |      41 |      86 |             1 | 2022-09-11 17:17:25 |
|  83 |      42 |      87 |             1 | 2022-09-11 17:17:25 |
|  84 |      43 |      88 |             1 | 2022-09-11 17:17:25 |
|  85 |      44 |      89 |             1 | 2022-09-11 17:17:25 |
|  86 |      44 |      90 |             1 | 2022-09-11 17:17:25 |
|  87 |      46 |      91 |             1 | 2022-09-11 17:17:25 |
|  88 |      47 |      92 |             1 | 2022-09-11 17:17:25 |
|  89 |      47 |      93 |             1 | 2022-09-11 17:17:25 |
|  90 |      48 |      94 |             1 | 2022-09-11 17:17:25 |
|  91 |      49 |      95 |             1 | 2022-09-11 17:17:25 |
|  92 |      50 |      96 |             1 | 2022-09-11 17:17:25 |
|  93 |      51 |      97 |             1 | 2022-09-11 17:17:25 |
|  94 |      52 |      98 |             1 | 2022-09-11 17:17:25 |
|  95 |      53 |      99 |             1 | 2022-09-11 17:17:25 |
|  96 |      54 |     100 |             1 | 2022-09-11 17:17:25 |
|  97 |      55 |     101 |             1 | 2022-09-11 17:17:25 |
|  98 |      56 |     102 |             1 | 2022-09-11 17:17:25 |
|  99 |      57 |     103 |             1 | 2022-09-11 17:17:25 |
| 102 |      45 |     106 |             1 | 2022-09-11 17:17:25 |
| 103 |      58 |     107 |             1 | 2022-09-11 17:17:25 |
| 104 |      59 |     108 |             1 | 2022-09-11 17:17:25 |
| 105 |      60 |     109 |             1 | 2022-09-11 17:17:25 |
| 106 |      61 |     110 |             1 | 2022-09-11 17:17:25 |
| 107 |      62 |     111 |             1 | 2022-09-11 17:17:25 |
| 108 |      63 |     112 |             1 | 2022-09-11 17:17:25 |
| 109 |      64 |     113 |             1 | 2022-09-11 17:17:25 |
| 112 |      69 |     117 |             1 | 2022-09-17 21:59:11 |
| 113 |      69 |     118 |             1 | 2022-09-17 21:59:12 |
+-----+---------+---------+---------------+---------------------+
37 rows in set (0.000 sec)

I also find the identical timestamp on the 35 earlier entries confusing. 35 might well be the amount of files I have attached in my personal Vikunja instance and I believe I did upload them all on 2022-09-11 but it definitely wasn’t all at the exact same time

I was not able to reproduce this on try, I suspect this to be a browser issue.

What browser and OS are you using?

Windows 10 with Firefox (should be the patched to the newest version).

I’ll check if it’s any different with Chrome and will report back