{"action":"created","issue":{"url":"https://api.github.com/repos/jl777/SuperNET/issues/600","repository_url":"https://api.github.com/repos/jl777/SuperNET","labels_url":"https://api.github.com/repos/jl777/SuperNET/issues/600/labels{/name}","comments_url":"https://api.github.com/repos/jl777/SuperNET/issues/600/comments","events_url":"https://api.github.com/repos/jl777/SuperNET/issues/600/events","html_url":"https://github.com/jl777/SuperNET/issues/600","id":299255818,"number":600,"title":"`swapstatus` kills `marketmaker` when called after `buy`","user":{"login":"lukechilds","id":2123375,"avatar_url":"https://avatars0.githubusercontent.com/u/2123375?v=4","gravatar_id":"","url":"https://api.github.com/users/lukechilds","html_url":"https://github.com/lukechilds","followers_url":"https://api.github.com/users/lukechilds/followers","following_url":"https://api.github.com/users/lukechilds/following{/other_user}","gists_url":"https://api.github.com/users/lukechilds/gists{/gist_id}","starred_url":"https://api.github.com/users/lukechilds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukechilds/subscriptions","organizations_url":"https://api.github.com/users/lukechilds/orgs","repos_url":"https://api.github.com/users/lukechilds/repos","events_url":"https://api.github.com/users/lukechilds/events{/privacy}","received_events_url":"https://api.github.com/users/lukechilds/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-22T08:09:34Z","updated_at":"2018-02-22T08:49:11Z","closed_at":null,"author_association":"NONE","body":"If you call `swapstatus` directly after calling `buy` it completely kills the entire mm process.\r\n\r\nThis was causing issue with our GUI as we're polling `swapstatus` on the exchange page to give reliable, up to date swap history and current swap state.\r\n\r\nHowever this is also reproducible via the CLI and nothing to do with the polling. It only occurs when the commands are called directly after each other. And obviously that's quite a common use case, after starting a trade order you're going to want to check the status.\r\n\r\n```shell\r\n# Setup coins in Electrum mode\r\n$ curl 'http://127.0.0.1:7783' --data '{\"userpass\":\"redacted\", \"method\":\"electrum\", \"coin\":\"KMD\", \"ipaddr\":\"electrum1.cipig.net\", \"port\":10001}' \r\n{\"ipaddr\":\"electrum1.cipig.net\",\"port\":10001,\"result\":\"success\"}\r\n\r\n$ curl 'http://127.0.0.1:7783' --data '{\"userpass\":\"redacted\", \"method\":\"electrum\", \"coin\":\"CHIPS\", \"ipaddr\":\"electrum1.cipig.net\", \"port\":10053}'\r\n{\"ipaddr\":\"electrum1.cipig.net\",\"port\":10053,\"result\":\"success\"}\r\n\r\n# Check the current order book to get an idea of a sensible price\r\n$ curl 'http://127.0.0.1:7783' --data '{\"userpass\":\"redacted\", \"method\":\"orderbook\", \"base\":\"CHIPS\", \"rel\":\"KMD\"}'\r\n{\"bids\":[{\"coin\":\"KMD\",\"address\":\"RFNAyiSWrDavovUSLHU4tiwP1K3XR1qbuN\",\"price\":0.08777562,\"numutxos\":43,\"avevolume\":1.72800000,\"maxvolume\":15.41600000,\"depth\":74.30400000,\"pubkey\":\"84896372344a408c5664fc5570cb19736f03f66a3e7f17a58cfa160468707c77\",\"age\":22,\"zcredits\":0}, {\"coin\":\"KMD\",\"address\":\"RQzkkncY8ehpRg8M4kvKmDMcbFxcJvohgk\",\"price\":0.08747055,\"numutxos\":255,\"avevolume\":2.06400000,\"maxvolume\":80,\"depth\":600.62400000,\"pubkey\":\"30eb3d952f66eba2df0100b97d6707257cf91dc8c8b0237cfb7c3aa70dc52d4d\",\"age\":1,\"zcredits\":0}],\"numbids\":2,\"biddepth\":750.78000000,\"asks\":[{\"coin\":\"CHIPS\",\"address\":\"RQzkkncY8ehpRg8M4kvKmDMcbFxcJvohgk\",\"price\":0.09753523,\"numutxos\":55,\"avevolume\":0.26139442,\"maxvolume\":4.67466851,\"depth\":14.37669293,\"pubkey\":\"30eb3d952f66eba2df0100b97d6707257cf91dc8c8b0237cfb7c3aa70dc52d4d\",\"age\":1,\"zcredits\":0}, {\"coin\":\"CHIPS\",\"address\":\"RXUF132uyPVTVUdLn16zCgvYoFXya3pyVb\",\"price\":0.09765861,\"numutxos\":81,\"avevolume\":0.28360061,\"maxvolume\":4.69776986,\"depth\":37.34834223,\"pubkey\":\"825d0e1355117f6b76e7b3741f51c1827e72e25ddc688c0b20ad5b1ec7b28b4f\",\"age\":6,\"zcredits\":0}, {\"coin\":\"CHIPS\",\"address\":\"RAzheh3L7QtBL7oNKByVa43CtgALht6bbT\",\"price\":0.09819276,\"numutxos\":132,\"avevolume\":0.39119994,\"maxvolume\":11.19711667,\"depth\":88.98673580,\"pubkey\":\"50959696e9d954d5853b113b54bfd695f7dd1a272f01700b13d6cd7e4b9bc704\",\"age\":2,\"zcredits\":0}, {\"coin\":\"CHIPS\",\"address\":\"RMdjuxKBhyr87yhKp6BLUg2p9673NMcPAu\",\"price\":0.09886392,\"numutxos\":84,\"avevolume\":0.47138318,\"maxvolume\":6.24424531,\"depth\":128.58292294,\"pubkey\":\"040f1d2d5d12027afa2cec30477312e225b0d24c77cc4aa08d3fffe51277b904\",\"age\":7,\"zcredits\":0}],\"numasks\":4,\"askdepth\":160.72865368,\"base\":\"CHIPS\",\"rel\":\"KMD\",\"timestamp\":1519284386,\"netid\":0}\r\n\r\n# Check swapstatus (succeeds)\r\n$ curl 'http://127.0.0.1:7783' --data '{\"userpass\":\"redacted\", \"method\":\"swapstatus\", \"base\":\"CHIPS\", \"rel\":\"KMD\"}'\r\n[]\r\n\r\n# Place buy order\r\n$ curl 'http://127.0.0.1:7783' --data '{\"userpass\":\"redacted\", \"method\":\"buy\", \"base\":\"CHIPS\", \"rel\":\"KMD\", \"relvolume\": 0.1, \"price\": 0.1})}'\r\n{\"result\":\"success\",\"swaps\":[],\"netamounts\":[],\"pending\":{\"expiration\":1519285404,\"timeleft\":360,\"tradeid\":redacted,\"requestid\":0,\"quoteid\":0,\"bob\":\"CHIPS\",\"base\":\"CHIPS\",\"basevalue\":1.00030019,\"alice\":\"KMD\",\"rel\":\"KMD\",\"relvalue\":0.10001000,\"aliceid\":redacted}}\r\n\r\n# Check swapstatus (kills mm)\r\n$ curl 'http://127.0.0.1:7783' --data '{\"userpass\":\"redacted\", \"method\":\"swapstatus\", \"base\":\"CHIPS\", \"rel\":\"KMD\"}'\r\ncurl: (52) Empty reply from server\r\n\r\n# mm is totally dead\r\n$ curl 'http://127.0.0.1:7783' --data '{\"userpass\":\"redacted\", \"method\":\"swapstatus\", \"base\":\"CHIPS\", \"rel\":\"KMD\"}'\r\ncurl: (7) Failed to connect to 127.0.0.1 port 7783: Connection refused\r\n```\r\n\r\nI've had this problem consistently for the last week and have been regularly updating mm, so it doesn't seem like anything that's been introduced recently. Swaps appear to go through ok if you place the buy order and leave it. It's checking the status directly after that's causing everything to break."},"comment":{"url":"https://api.github.com/repos/jl777/SuperNET/issues/comments/367608187","html_url":"https://github.com/jl777/SuperNET/issues/600#issuecomment-367608187","issue_url":"https://api.github.com/repos/jl777/SuperNET/issues/600","id":367608187,"user":{"login":"lukechilds","id":2123375,"avatar_url":"https://avatars0.githubusercontent.com/u/2123375?v=4","gravatar_id":"","url":"https://api.github.com/users/lukechilds","html_url":"https://github.com/lukechilds","followers_url":"https://api.github.com/users/lukechilds/followers","following_url":"https://api.github.com/users/lukechilds/following{/other_user}","gists_url":"https://api.github.com/users/lukechilds/gists{/gist_id}","starred_url":"https://api.github.com/users/lukechilds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lukechilds/subscriptions","organizations_url":"https://api.github.com/users/lukechilds/orgs","repos_url":"https://api.github.com/users/lukechilds/repos","events_url":"https://api.github.com/users/lukechilds/events{/privacy}","received_events_url":"https://api.github.com/users/lukechilds/received_events","type":"User","site_admin":false},"created_at":"2018-02-22T08:49:11Z","updated_at":"2018-02-22T08:49:11Z","author_association":"NONE","body":"Thanks.\r\n\r\nI have previously tested calling `buy`,  then `portfolio`, then `swapstatus`.\r\n\r\nThe portfolio command succeeded, it was only once the `swapstatus` was called that everything dies.\r\n\r\nAnd I had also tested calling `buy` and then waiting for a while and the buy order filled successfully and I could issue commands to mm after waiting.\r\n\r\nI know you store swap history in a file on disk, could it be that the `buy` command is still doing something with the text file while the `swapstatus` command is trying to read it? Or something along those lines?"}}
{"actor":{"display_login":"lukechilds"}}