maproulette / maproulette/maproulette-backend

/tasks API causes SO

Open
#261 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

BACKLOG
Dominant language
Scala
Stars
53
Forks
39
Avg merge
1d 17h
Merged PRs (30d)
12

Description

posting the following to /api/v2/tasks causes a SO:

[
  {
    "name": "1-2-3",
    "parent": 1462,
    "identifier": "1-2-3",
    "instruction": "",
    "status": 0,
    "geometries": {
      "type":"FeatureCollection",
      "features":[
         {"type":"Feature",
          "geometry":
           {
              "type":"Point",
              "coordinates":[-92.67,38.106509010989]
           },
           "properties":
            {
              "title": "Probable rouadabout",
              "identifier": "1991"
            }
         }
      ]
    }
  }
]

console:

java.lang.StackOverflowError
                at play.api.libs.json.Json$.fromJson(Json.scala:125)
                at org.maproulette.models.Task$TaskFormat$.reads(Task.scala:93)
                at play.api.libs.json.Json$.fromJson(Json.scala:125)
                at org.maproulette.models.Task$TaskFormat$.reads(Task.scala:93)
                at play.api.libs.json.Json$.fromJson(Json.scala:125)
                at org.maproulette.models.Task$TaskFormat$.reads(Task.scala:93)
                at play.api.libs.json.Json$.fromJson(Json.scala:125)
                at org.maproulette.models.Task$TaskFormat$.reads(Task.scala:93)
                at play.api.libs.json.Json$.fromJson(Json.scala:125)
                at org.maproulette.models.Task$TaskFormat$.reads(Task.scala:93)
                at play.api.libs.json.Json$.fromJson(Json.scala:125)
                at org.maproulette.models.Task$TaskFormat$.reads(Task.scala:93)
                at play.api.libs.json.Json$.fromJson(Json.scala:125)
                at org.maproulette.models.Task$TaskFormat$.reads(Task.scala:93)
                at play.api.libs.json.Json$.fromJson(Json.scala:125)
                at org.maproulette.models.Task$TaskFormat$.reads(Task.scala:93)
                at play.api.libs.json.Json$.fromJson(Json.scala:125)
                at org.maproulette.models.Task$TaskFormat$.reads(Task.scala:93)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the POST to /api/v2/tasks with the JSON payload and inspect Task.scala around line 93, where the stack trace repeatedly enters Task$TaskFormat$.reads. Trace the recursive JSON parsing and add or update a focused test for this request. Done means the request no longer produces a java.lang.StackOverflowError.

Written by the indexing model from the issue text.

Assessment

Tech stack
scala
Domain
api, backend
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.