Skip to content

Bug report: Out of memory when fetching aggregates with most recent contract transactions #254

Open
@MBeliou

Description

@MBeliou

Prerequisites

Expected Behavior

Running the query should return a result

Current Behavior

We get some sort of out of memory exception

{
  "errors": [
    {
      "message": "could not resize shared memory segment \"/PostgreSQL.2197826890\" to 8388608 bytes: No space left on device",
      "locations": [
        {
          "line": 2,
          "column": 3
        }
      ],
      "path": [
        "executeContractMessages"
      ],
      "extensions": {
        "code": "INTERNAL_SERVER_ERROR",
        "exception": {
          "length": 166,
          "name": "error",
          "severity": "ERROR",
          "code": "53100",
          "file": "dsm_impl.c",
          "line": "311",
          "routine": "dsm_impl_posix",
          "stacktrace": [
            "error: could not resize shared memory segment \"/PostgreSQL.2197826890\" to 8388608 bytes: No space left on device",
            "    at Parser.parseErrorMessage (/app/node_modules/pg-protocol/dist/parser.js:287:98)",
            "    at Parser.handlePacket (/app/node_modules/pg-protocol/dist/parser.js:126:29)",
            "    at Parser.parse (/app/node_modules/pg-protocol/dist/parser.js:39:38)",
            "    at Socket.<anonymous> (/app/node_modules/pg-protocol/dist/index.js:11:42)",
            "    at Socket.emit (node:events:527:28)",
            "    at addChunk (node:internal/streams/readable:315:12)",
            "    at readableAddChunk (node:internal/streams/readable:289:9)",
            "    at Socket.Readable.push (node:internal/streams/readable:228:10)",
            "    at TCP.onStreamRead (node:internal/stream_base_commons:190:23)",
            "    at TCP.callbackTrampoline (node:internal/async_hooks:130:17)"
          ]
        }
      }
    }
  ],
  "data": {
    "executeContractMessages": null
  }
}

Steps To Reproduce

You only need to run this query on mainnet subquery

query lastweek_mostUsedContracts {
  executeContractMessages(
    first: 100
    orderBy: EXECUTE_CONTRACT_MESSAGES_BY_BLOCK_HEIGHT_DESC
    filter: { block: { height: { greaterThan: "10030799" } } }
  ) 
  {
    totalCount

    nodes {
      contract
      funds
      transaction {
        gasUsed
        fees
      }
    }
    contractAggregate: groupedAggregates(groupBy: CONTRACT) {
      keys

      distinctCount {
        id
      }
    }
  }
}

Context

Running the query on mainnet fetch.ai subquery

Failure Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions