{"action":"closed","number":1001,"pull_request":{"url":"https://api.github.com/repos/vim/vim/pulls/1001","id":82357564,"html_url":"https://github.com/vim/vim/pull/1001","diff_url":"https://github.com/vim/vim/pull/1001.diff","patch_url":"https://github.com/vim/vim/pull/1001.patch","issue_url":"https://api.github.com/repos/vim/vim/issues/1001","number":1001,"state":"closed","locked":false,"title":"It's difficult for channel server to parse messages from ch_evalexpr() and ch_sendexpr()","user":{"login":"haya14busa","id":3797062,"avatar_url":"https://avatars.githubusercontent.com/u/3797062?v=3","gravatar_id":"","url":"https://api.github.com/users/haya14busa","html_url":"https://github.com/haya14busa","followers_url":"https://api.github.com/users/haya14busa/followers","following_url":"https://api.github.com/users/haya14busa/following{/other_user}","gists_url":"https://api.github.com/users/haya14busa/gists{/gist_id}","starred_url":"https://api.github.com/users/haya14busa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haya14busa/subscriptions","organizations_url":"https://api.github.com/users/haya14busa/orgs","repos_url":"https://api.github.com/users/haya14busa/repos","events_url":"https://api.github.com/users/haya14busa/events{/privacy}","received_events_url":"https://api.github.com/users/haya14busa/received_events","type":"User","site_admin":false},"body":"Hi, bram.\r\n\r\nAs [patch 7.4.1252](https://github.com/vim/vim/commit/e7bed627c89ed80bc4b2d96f542819029adf6e76) said, channel servers may receive multiple messages concatenated like this one (`[1,\"hello!\"][2,\"hello!\"]`).\r\n\r\nIt may also occurs in every channel servers including sample demoserver.py ($VIMRUNTIME/tools/demoserver.py)\r\n\r\n### How to Reproduce\r\n\r\n#### test.vim\r\n```vim\r\nfunction! s:test() abort\r\n  let handle = ch_open('localhost:8765')\r\n  for _ in range(10)\r\n    call ch_sendexpr(handle, 'hello!')\r\n  endfor\r\nendfunction\r\n\r\ncall s:test()\r\n```\r\n\r\n1. $ python demoserver.py ($VIMRUNTIME/tools/demoserver.py)\r\n2. $ vim test.vim\r\n3. :source %\r\n\r\nWe can see following server error like this.\r\n\r\n```\r\n=== socket opened ===\r\nreceived: [1,\"hello!\"][2,\"hello!\"][3,\"hello!\"][4,\"hello!\"][5,\"hello!\"][6,\"hello!\"][7,\"hello!\"][8,\"hello!\"]\r\njson decoding failed\r\nreceived: [9,\"hello!\"][10,\"hello!\"]\r\njson decoding failed\r\n=== socket closed ===\r\n```\r\n\r\n### Solution\r\n[patch 7.4.1252](https://github.com/vim/vim/commit/e7bed627c89ed80bc4b2d96f542819029adf6e76) fixed the test server by finding `][`, but it doesn't handle messages which contains `][`.\r\nOn top of that, every channel servers, regardless of programing language, have to handle this problem.\r\nIt's possible, but really troublesome to handle messages correctly.\r\n\r\nSo, I suggest to use '\\n' as delimiter which is handy for channel servers, regardless of  programing language, to handle messages.\r\n\r\nHow do you think?\r\nI guess we cannot change channel specification after Vim 8.0 release, so we should include this change or include other solution.\r\n\r\n### Other\r\nThis pull request doens't include doc changes nor demoserver.py improvement.\r\nThis pull request just intends to show the problem and disscuss it. Of course, you can discard this patch.\r\nThis patch includes @k-takata's work. Thanks @k-takata.\r\n\r\n","created_at":"2016-08-23T12:45:19Z","updated_at":"2016-08-26T15:59:04Z","closed_at":"2016-08-26T15:59:04Z","merged_at":null,"merge_commit_sha":"5709842da4d130193fa3d9ea589097ddbcde02da","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/vim/vim/pulls/1001/commits","review_comments_url":"https://api.github.com/repos/vim/vim/pulls/1001/comments","review_comment_url":"https://api.github.com/repos/vim/vim/pulls/comments{/number}","comments_url":"https://api.github.com/repos/vim/vim/issues/1001/comments","statuses_url":"https://api.github.com/repos/vim/vim/statuses/e140240661ee62260703d1c0d1884d5eae73290b","head":{"label":"haya14busa:socket-delimiter","ref":"socket-delimiter","sha":"e140240661ee62260703d1c0d1884d5eae73290b","user":{"login":"haya14busa","id":3797062,"avatar_url":"https://avatars.githubusercontent.com/u/3797062?v=3","gravatar_id":"","url":"https://api.github.com/users/haya14busa","html_url":"https://github.com/haya14busa","followers_url":"https://api.github.com/users/haya14busa/followers","following_url":"https://api.github.com/users/haya14busa/following{/other_user}","gists_url":"https://api.github.com/users/haya14busa/gists{/gist_id}","starred_url":"https://api.github.com/users/haya14busa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haya14busa/subscriptions","organizations_url":"https://api.github.com/users/haya14busa/orgs","repos_url":"https://api.github.com/users/haya14busa/repos","events_url":"https://api.github.com/users/haya14busa/events{/privacy}","received_events_url":"https://api.github.com/users/haya14busa/received_events","type":"User","site_admin":false},"repo":{"id":55014626,"name":"vim","full_name":"haya14busa/vim","owner":{"login":"haya14busa","id":3797062,"avatar_url":"https://avatars.githubusercontent.com/u/3797062?v=3","gravatar_id":"","url":"https://api.github.com/users/haya14busa","html_url":"https://github.com/haya14busa","followers_url":"https://api.github.com/users/haya14busa/followers","following_url":"https://api.github.com/users/haya14busa/following{/other_user}","gists_url":"https://api.github.com/users/haya14busa/gists{/gist_id}","starred_url":"https://api.github.com/users/haya14busa/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/haya14busa/subscriptions","organizations_url":"https://api.github.com/users/haya14busa/orgs","repos_url":"https://api.github.com/users/haya14busa/repos","events_url":"https://api.github.com/users/haya14busa/events{/privacy}","received_events_url":"https://api.github.com/users/haya14busa/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/haya14busa/vim","description":"The official Vim repository","fork":true,"url":"https://api.github.com/repos/haya14busa/vim","forks_url":"https://api.github.com/repos/haya14busa/vim/forks","keys_url":"https://api.github.com/repos/haya14busa/vim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/haya14busa/vim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/haya14busa/vim/teams","hooks_url":"https://api.github.com/repos/haya14busa/vim/hooks","issue_events_url":"https://api.github.com/repos/haya14busa/vim/issues/events{/number}","events_url":"https://api.github.com/repos/haya14busa/vim/events","assignees_url":"https://api.github.com/repos/haya14busa/vim/assignees{/user}","branches_url":"https://api.github.com/repos/haya14busa/vim/branches{/branch}","tags_url":"https://api.github.com/repos/haya14busa/vim/tags","blobs_url":"https://api.github.com/repos/haya14busa/vim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/haya14busa/vim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/haya14busa/vim/git/refs{/sha}","trees_url":"https://api.github.com/repos/haya14busa/vim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/haya14busa/vim/statuses/{sha}","languages_url":"https://api.github.com/repos/haya14busa/vim/languages","stargazers_url":"https://api.github.com/repos/haya14busa/vim/stargazers","contributors_url":"https://api.github.com/repos/haya14busa/vim/contributors","subscribers_url":"https://api.github.com/repos/haya14busa/vim/subscribers","subscription_url":"https://api.github.com/repos/haya14busa/vim/subscription","commits_url":"https://api.github.com/repos/haya14busa/vim/commits{/sha}","git_commits_url":"https://api.github.com/repos/haya14busa/vim/git/commits{/sha}","comments_url":"https://api.github.com/repos/haya14busa/vim/comments{/number}","issue_comment_url":"https://api.github.com/repos/haya14busa/vim/issues/comments{/number}","contents_url":"https://api.github.com/repos/haya14busa/vim/contents/{+path}","compare_url":"https://api.github.com/repos/haya14busa/vim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/haya14busa/vim/merges","archive_url":"https://api.github.com/repos/haya14busa/vim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/haya14busa/vim/downloads","issues_url":"https://api.github.com/repos/haya14busa/vim/issues{/number}","pulls_url":"https://api.github.com/repos/haya14busa/vim/pulls{/number}","milestones_url":"https://api.github.com/repos/haya14busa/vim/milestones{/number}","notifications_url":"https://api.github.com/repos/haya14busa/vim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/haya14busa/vim/labels{/name}","releases_url":"https://api.github.com/repos/haya14busa/vim/releases{/id}","deployments_url":"https://api.github.com/repos/haya14busa/vim/deployments","created_at":"2016-03-29T22:24:47Z","updated_at":"2016-03-29T22:25:14Z","pushed_at":"2016-08-23T12:20:17Z","git_url":"git://github.com/haya14busa/vim.git","ssh_url":"git@github.com:haya14busa/vim.git","clone_url":"https://github.com/haya14busa/vim.git","svn_url":"https://github.com/haya14busa/vim","homepage":"http://www.vim.org","size":56470,"stargazers_count":0,"watchers_count":0,"language":"C","has_issues":false,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":3,"forks":0,"open_issues":3,"watchers":0,"default_branch":"master"}},"base":{"label":"vim:master","ref":"master","sha":"1b58cdd160c2e0ada0f638679a2aa27e4665fc48","user":{"login":"vim","id":11618545,"avatar_url":"https://avatars.githubusercontent.com/u/11618545?v=3","gravatar_id":"","url":"https://api.github.com/users/vim","html_url":"https://github.com/vim","followers_url":"https://api.github.com/users/vim/followers","following_url":"https://api.github.com/users/vim/following{/other_user}","gists_url":"https://api.github.com/users/vim/gists{/gist_id}","starred_url":"https://api.github.com/users/vim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vim/subscriptions","organizations_url":"https://api.github.com/users/vim/orgs","repos_url":"https://api.github.com/users/vim/repos","events_url":"https://api.github.com/users/vim/events{/privacy}","received_events_url":"https://api.github.com/users/vim/received_events","type":"Organization","site_admin":false},"repo":{"id":40997482,"name":"vim","full_name":"vim/vim","owner":{"login":"vim","id":11618545,"avatar_url":"https://avatars.githubusercontent.com/u/11618545?v=3","gravatar_id":"","url":"https://api.github.com/users/vim","html_url":"https://github.com/vim","followers_url":"https://api.github.com/users/vim/followers","following_url":"https://api.github.com/users/vim/following{/other_user}","gists_url":"https://api.github.com/users/vim/gists{/gist_id}","starred_url":"https://api.github.com/users/vim/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vim/subscriptions","organizations_url":"https://api.github.com/users/vim/orgs","repos_url":"https://api.github.com/users/vim/repos","events_url":"https://api.github.com/users/vim/events{/privacy}","received_events_url":"https://api.github.com/users/vim/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/vim/vim","description":"The official Vim repository","fork":false,"url":"https://api.github.com/repos/vim/vim","forks_url":"https://api.github.com/repos/vim/vim/forks","keys_url":"https://api.github.com/repos/vim/vim/keys{/key_id}","collaborators_url":"https://api.github.com/repos/vim/vim/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/vim/vim/teams","hooks_url":"https://api.github.com/repos/vim/vim/hooks","issue_events_url":"https://api.github.com/repos/vim/vim/issues/events{/number}","events_url":"https://api.github.com/repos/vim/vim/events","assignees_url":"https://api.github.com/repos/vim/vim/assignees{/user}","branches_url":"https://api.github.com/repos/vim/vim/branches{/branch}","tags_url":"https://api.github.com/repos/vim/vim/tags","blobs_url":"https://api.github.com/repos/vim/vim/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/vim/vim/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/vim/vim/git/refs{/sha}","trees_url":"https://api.github.com/repos/vim/vim/git/trees{/sha}","statuses_url":"https://api.github.com/repos/vim/vim/statuses/{sha}","languages_url":"https://api.github.com/repos/vim/vim/languages","stargazers_url":"https://api.github.com/repos/vim/vim/stargazers","contributors_url":"https://api.github.com/repos/vim/vim/contributors","subscribers_url":"https://api.github.com/repos/vim/vim/subscribers","subscription_url":"https://api.github.com/repos/vim/vim/subscription","commits_url":"https://api.github.com/repos/vim/vim/commits{/sha}","git_commits_url":"https://api.github.com/repos/vim/vim/git/commits{/sha}","comments_url":"https://api.github.com/repos/vim/vim/comments{/number}","issue_comment_url":"https://api.github.com/repos/vim/vim/issues/comments{/number}","contents_url":"https://api.github.com/repos/vim/vim/contents/{+path}","compare_url":"https://api.github.com/repos/vim/vim/compare/{base}...{head}","merges_url":"https://api.github.com/repos/vim/vim/merges","archive_url":"https://api.github.com/repos/vim/vim/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/vim/vim/downloads","issues_url":"https://api.github.com/repos/vim/vim/issues{/number}","pulls_url":"https://api.github.com/repos/vim/vim/pulls{/number}","milestones_url":"https://api.github.com/repos/vim/vim/milestones{/number}","notifications_url":"https://api.github.com/repos/vim/vim/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/vim/vim/labels{/name}","releases_url":"https://api.github.com/repos/vim/vim/releases{/id}","deployments_url":"https://api.github.com/repos/vim/vim/deployments","created_at":"2015-08-18T21:03:56Z","updated_at":"2016-08-26T14:36:46Z","pushed_at":"2016-08-26T15:59:03Z","git_url":"git://github.com/vim/vim.git","ssh_url":"git@github.com:vim/vim.git","clone_url":"https://github.com/vim/vim.git","svn_url":"https://github.com/vim/vim","homepage":"http://www.vim.org","size":63782,"stargazers_count":5506,"watchers_count":5506,"language":"C","has_issues":true,"has_downloads":false,"has_wiki":false,"has_pages":false,"forks_count":627,"mirror_url":null,"open_issues_count":273,"forks":627,"open_issues":273,"watchers":5506,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/vim/vim/pulls/1001"},"html":{"href":"https://github.com/vim/vim/pull/1001"},"issue":{"href":"https://api.github.com/repos/vim/vim/issues/1001"},"comments":{"href":"https://api.github.com/repos/vim/vim/issues/1001/comments"},"review_comments":{"href":"https://api.github.com/repos/vim/vim/pulls/1001/comments"},"review_comment":{"href":"https://api.github.com/repos/vim/vim/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/vim/vim/pulls/1001/commits"},"statuses":{"href":"https://api.github.com/repos/vim/vim/statuses/e140240661ee62260703d1c0d1884d5eae73290b"}},"merged":false,"mergeable":false,"mergeable_state":"dirty","merged_by":null,"comments":1,"review_comments":0,"commits":2,"additions":16,"deletions":2,"changed_files":4}}
{"actor":{"display_login":"brammool"}}