Hi. I am getting the following error from prisma v...
# prisma1-community
s
Hi. I am getting the following error from prisma very often now. I am using 
prisma1
 + 
mongo
Copy code
GraphQL Error: {
  "0": "<",
  "1": "h",
  "2": "t",
  "3": "m",
  "4": "l",
  "5": ">",
  "6": "\r",
  "7": "\n",
  "8": "<",
  "9": "h",
  "10": "e",
  "11": "a",
  "12": "d",
  "13": ">",
  "14": "<",
  "15": "t",
  "16": "i",
  "17": "t",
  "18": "l",
  "19": "e",
  "20": ">",
  "21": "5",
  "22": "0",
  "23": "2",
  "24": " ",
  "25": "B",
  "26": "a",
  "27": "d",
  "28": " ",
  "29": "G",
  "30": "a",
  "31": "t",
  "32": "e",
  "33": "w",
  "34": "a",
  "35": "y",
  "36": "<",
  "37": "/",
  "38": "t",
  "39": "i",
  "40": "t",
  "41": "l",
  "42": "e",
  "43": ">",
  "44": "<",
  "45": "/",
  "46": "h",
  "47": "e",
  "48": "a",
  "49": "d",
  "50": ">",
  "51": "\r",
  "52": "\n",
  "53": "<",
  "54": "b",
  "55": "o",
  "56": "d",
  "57": "y",
  "58": " ",
  "59": "b",
  "60": "g",
  "61": "c",
  "62": "o",
  "63": "l",
  "64": "o",
  "65": "r",
  "66": "=",
  "67": "\"",
  "68": "w",
  "69": "h",
  "70": "i",
  "71": "t",
  "72": "e",
  "73": "\"",
  "74": ">",
  "75": "\r",
  "76": "\n",
  "77": "<",
  "78": "c",
  "79": "e",
  "80": "n",
  "81": "t",
  "82": "e",
  "83": "r",
  "84": ">",
  "85": "<",
  "86": "h",
  "87": "1",
  "88": ">",
  "89": "5",
  "90": "0",
  "91": "2",
  "92": " ",
  "93": "B",
  "94": "a",
  "95": "d",
  "96": " ",
  "97": "G",
  "98": "a",
  "99": "t",
  "100": "e",
  "101": "w",
  "102": "a",
  "103": "y",
  "104": "<",
  "105": "/",
  "106": "h",
  "107": "1",
  "108": ">",
  "109": "<",
  "110": "/",
  "111": "c",
  "112": "e",
  "113": "n",
  "114": "t",
  "115": "e",
  "116": "r",
  "117": ">",
  "118": "\r",
  "119": "\n",
  "120": "<",
  "121": "h",
  "122": "r",
  "123": ">",
  "124": "<",
  "125": "c",
  "126": "e",
  "127": "n",
  "128": "t",
  "129": "e",
  "130": "r",
  "131": ">",
  "132": "n",
  "133": "g",
  "134": "i",
  "135": "n",
  "136": "x",
  "137": "/",
  "138": "1",
  "139": ".",
  "140": "1",
  "141": "4",
  "142": ".",
  "143": "0",
  "144": " ",
  "145": "(",
  "146": "U",
  "147": "b",
  "148": "u",
  "149": "n",
  "150": "t",
  "151": "u",
  "152": ")",
  "153": "<",
  "154": "/",
  "155": "c",
  "156": "e",
  "157": "n",
  "158": "t",
  "159": "e",
  "160": "r",
  "161": ">",
  "162": "\r",
  "163": "\n",
  "164": "<",
  "165": "/",
  "166": "b",
  "167": "o",
  "168": "d",
  "169": "y",
  "170": ">",
  "171": "\r",
  "172": "\n",
  "173": "<",
  "174": "/",
  "175": "h",
  "176": "t",
  "177": "m",
  "178": "l",
  "179": ">",
  "180": "\r",
  "181": "\n",
  "status": 502
}
I am stuck here. What could be the reason? If I wait, half an hour, and send no query, this error would usually go away. It just says GraphQL error :  
bad gateway
t
Seems like your nginx/ubuntu server is returning 502 bad gateway response. You need to check your server logs what really went wrong.
s
Are you sure this is because of nginx/ubuntu? No issue with Prisma?
Because it says GraphQL error
If you would see the top of the message, it says that.
t
Yes. The error above is actually html response from your server and converted to Json response by character.
s
I'll check this. Why does it say
GraphQL error
at the beginning of the message?
t
I’m not sure about that. You need to check server error logs to find out more.
s
I am checking
I checked the logs
Prisma has some connection exception errors
[INFO] Closed connection [connectionId{localValue:100, serverValue:505819}] to 20.40.43.30:27017 because there was a socket exception raised by this connection.
[INFO] Closed connection [connectionId{localValue:9, serverValue:505727}] to 20.40.43.30:27017 because there was a socket exception raised on another connection from this pool.
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
... 3 more
java.lang.OutOfMemoryError: Java heap space
[INFO] Closed connection [connectionId{localValue:33, serverValue:505751}] to 20.40.43.30:27017 because there was a socket exception raised on another connection from this pool.
Would you know this? Why could this occur? @Thenesh
I have opened up an issue here https://github.com/prisma/prisma/issues/3156. Restarting prisma resolved the issue. But I have been getting this a lot. Not sure what to do here.
j
@Suhail You need to allocate more memory. It crashes because its out of memory
r
Yes @joar is correct. This is a memory issue so you would need to allocate more memory.
s
What is the recommended size? I see CPU usage taking a hit when I run prisma with mongo.
@joar @Ryan
Also, what is the default allocated?
r
How much is allocated currently?
s
Shared
Is that okay?
r
You would need to provide more memory via the
JAVA_OPTS
option while deploying the Prisma Server. Try adding 50 % more of what you have and deploy.
s
Do I need to do it before the deployment? Will the sequence matter?
Is it that I have to modify the prisma docker image? This is how I have used @Ryan
r
Yes you would need to add it the options in the docker image as specified here.
s
Could you please give a sample value?
I am not sure how to edit this
r
I’m not sure how you have deployed your Prisma server, but if it’s using docker then a sample value would be something like this in added to the environment variable: Key: JAVA_OPTS Value: -Xmx2048m This will allocate 2 GB to the Max heap memory
s
I had deployed using the docker-compose.yml as suggested in the documentation. Here is also the screenshot of my docker-compose.yml
r
Then you would need to add it in this manner:
Copy code
prisma:
    image: prismagraphql/prisma:1.34
    restart: always
    ports:
      - '4466:4466'
    environment:
      JAVA_OPTS: '-Xmx2048m'
      PRISMA_CONFIG: |
        port: 4466
        databases:
          default:
            connector: mongo
            uri: <uri>
s
Should I increase the heap size to 4096 MB
Will that be an issue?
From the screenshot shared above, I think it is already at
2 GB
?
r
Yes you could increase it to 4GB
s
I changed my kubernetes yaml yml as follows
But I do not see the heap size getting increased
The heap command gives out
r
Could you run
docker-compose up
after running
docker-compose down
again? Also if possible inspect the server and check if it has been applied as this is the way the option is added.
As you can see here I have gone into the container and checked that the option is being applied successfully
s
@Saiprasanth
Alright,
htop
gives out
4096
The one that I updated. Should be okay then? Any other way to verify?
Considering
4GB
of the heap size, what would be the total RAM size you would recommend? Currently, it is deployed with
8GB
of RAM
@Ryan
r
You should be fine at 8GB
s
Okay.