0

I am using Ubuntu 20.04 (LTS) x64, NGINX, memory 1 GB, Dart SDK version: 2.19.4 (stable) , and Dart server. I run this dart server in the console with:

pm2 start dart --name dart_server -- run dart_server/bin/dart_server.dart
pm2 logs

The issue happened when the server tried to save a file(image) to the folder in the server(it happened in the host but it will be fine if run on my PC). This issue is the dart server terminated and gives an error:

/snap/flutter/130/dart.sh: line 20: 130841 Killed                  $DART "$@"

The example processing of my code is shown in the image below. enter image description here

I tried --old_gen_heap_size=2048 and this did not help anything. After I tried to check this issue, I found the issue happened when the server is uploading files. This error will happen in the save file to a directory step. The server can receive files of more than 2MB and 100MB but it will error in this step with:

  • a file has a size of more than 2 MB
  • files size sums (size <= 2 MB) more than 2-3 MB

I tried to find this issue on the internet but not found anything. For using the chat GPT, it said this error indicates about of memory. but my host memory is 1GB and this step just uploads files lower than 3 MB. I don't understand this. I used a PHP server and this doesn't have an error like this.

I don't know why this files size sums (size <= 2 MB) more than 2-3 MB issue is happening. In my opinion When the first file(2 MB) is saved the memory used for the first file should be free then the second file should save with success like this

  • When the server doesn't start to save files. The memory uses A
  • The server tries to save the first file. The memory uses A + B
  • The server saved the first file. The memory uses A
  • The server tries to save the second file. The memory uses A + C
  • ....

Isn't it? How to fix this? I want to make the server can save files with the file size maximum lower than 10MB and a sum of files size lower than 1000 MB. (my server can receive but can't save these files)

I am not sure if this issue seems like not happened to other people, but I can't find anyone that faces this issue.

0 Answers0