{
   "expand": "operations,versionedRepresentations,editmeta,changelog,renderedFields",
   "id": "225656",
   "self": "https://bugs.mojang.com/rest/api/2/issue/225656",
   "key": "BDS-437",
   "fields": {
      "issuetype": "1",
      "project": "11700",
      "fixVersions": [],
      "resolution": "7",
      "customfield_10500": null,
      "customfield_12800": null,
      "customfield_12602": [],
      "customfield_12601": null,
      "customfield_12604": null,
      "customfield_12603": null,
      "customfield_12606": null,
      "customfield_12605": null,
      "customfield_12608": null,
      "resolutiondate": "2020-02-10T12:56:11.000+0200",
      "customfield_12607": null,
      "customfield_12609": null,
      "workratio": -1,
      "lastViewed": null,
      "watches": {
         "self": "https://bugs.mojang.com/rest/api/2/issue/BDS-437/watchers",
         "watchCount": 1,
         "isWatching": false
      },
      "created": "2019-01-27T21:48:06.000+0200",
      "customfield_12000": null,
      "customfield_12201": null,
      "customfield_12600": null,
      "labels": [],
      "customfield_11700": "{}",
      "versions": [
         "17513"
      ],
      "issuelinks": [
         {
            "id": "198103",
            "self": "https://bugs.mojang.com/rest/api/2/issueLink/198103",
            "type": "10102",
            "outwardIssue": "217255"
         }
      ],
      "assignee": null,
      "updated": "2020-08-09T15:38:51.000+0300",
      "status": "5",
      "description": "Bedrock server should handle signals like SIGTERM and SIGINT for Linux like Java edition does. One of the benefits of doing that is that we can set bedrock server as a system service and it'll stop gracefully whenever the admin wants to stop the service or the system is shutting down.\n\nCurrently when it receives any of these signals it closes the server instantly without having the opportunity of cleaning up the server and it may lead to world corruption or worse.",
      "customfield_11100": null,
      "customfield_11300": null,
      "customfield_11500": null,
      "customfield_12503": null,
      "customfield_12700": null,
      "customfield_12502": null,
      "customfield_12504": null,
      "attachment": [],
      "summary": "Should handle SIGINT and SIGTERM signals",
      "creator": "nikalon",
      "reporter": "nikalon",
      "customfield_10002": null,
      "customfield_12501": null,
      "customfield_12500": null,
      "customfield_11601": null,
      "customfield_11600": "0|i0wzof:",
      "environment": null,
      "customfield_11801": null,
      "customfield_11800": null,
      "customfield_11602": null,
      "customfield_11802": null,
      "comment": {
         "comments": [
            {
               "self": "https://bugs.mojang.com/rest/api/2/issue/225656/comment/515608",
               "id": "515608",
               "author": "tofulisk",
               "body": "+1 on this.\u00a0 I believe SIGINT is already handled (Ctrl-C in terminal will log the \"Quit correctly\" message); however, SIGTERM is definitely NOT handled, and this makes dockerizing more difficult as well.",
               "updateAuthor": "tofulisk",
               "created": "2019-01-30T07:08:25.183+0200",
               "updated": "2019-01-30T07:08:25.183+0200"
            },
            {
               "self": "https://bugs.mojang.com/rest/api/2/issue/225656/comment/515609",
               "id": "515609",
               "author": "tofulisk",
               "body": "In the meantime, you can wrap the server in a shell script to handle SIGTERM and shutdown the server gracefully by issuing a \"stop\" command.\u00a0 It ain't pretty, but it works...\n\nHere's the *dash* script I use.\u00a0 _(do not run with bash!)_\n{code:java}\nset -e\npipe=/run/minecraft/pipe.$$\n\nmkfifo $pipe\nexec 3<> $pipe\nrm $pipe\n\n<&3 3>&- LD_LIBRARY_PATH=. ./bedrock_server & pid=$!\nexec >&3 3<&-\n\ntrap 'echo stop' INT TERM\ntrap : CHLD\n\nwhile read -r line; do echo $line; done\nwait $pid\nexit $?\n{code}",
               "updateAuthor": "tofulisk",
               "created": "2019-01-30T07:26:16.951+0200",
               "updated": "2019-01-30T07:26:16.951+0200"
            },
            {
               "self": "https://bugs.mojang.com/rest/api/2/issue/225656/comment/631837",
               "id": "631837",
               "author": "ionicecko",
               "body": "Could a mod please link to BDS-203 and close this issue.",
               "updateAuthor": "ionicecko",
               "created": "2020-02-10T08:04:03.414+0200",
               "updated": "2020-02-10T08:04:03.414+0200"
            }
         ],
         "maxResults": 3,
         "total": 3,
         "startAt": 0
      },
      "votes": {
         "self": "https://bugs.mojang.com/rest/api/2/issue/BDS-437/votes",
         "votes": 1,
         "hasVoted": false
      }
   },
   "changelog": {
      "startAt": 0,
      "maxResults": 2,
      "total": 2,
      "histories": [
         {
            "id": "1431428",
            "author": "mega_spud",
            "created": "2020-02-10T12:56:11.232+0200",
            "items": [
               {
                  "field": "resolution",
                  "fieldtype": "jira",
                  "from": null,
                  "fromString": null,
                  "to": "7",
                  "toString": "Invalid"
               },
               {
                  "field": "status",
                  "fieldtype": "jira",
                  "from": "1",
                  "fromString": "Open",
                  "to": "5",
                  "toString": "Resolved"
               }
            ]
         },
         {
            "id": "1758792",
            "author": "ionicecko",
            "created": "2020-08-09T15:38:51.839+0300",
            "items": [
               {
                  "field": "Link",
                  "fieldtype": "jira",
                  "from": null,
                  "fromString": null,
                  "to": "BDS-203",
                  "toString": "This issue duplicates BDS-203"
               }
            ]
         }
      ]
   }
}