{"action":"created","issue":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/13578","labels_url":"https://api.github.com/repos/JuliaLang/julia/issues/13578/labels{/name}","comments_url":"https://api.github.com/repos/JuliaLang/julia/issues/13578/comments","events_url":"https://api.github.com/repos/JuliaLang/julia/issues/13578/events","html_url":"https://github.com/JuliaLang/julia/issues/13578","id":111154706,"number":13578,"title":"Remotecall_fetch produces EINVAL error when returning a large array","user":{"login":"Allardvm","id":11735900,"avatar_url":"https://avatars.githubusercontent.com/u/11735900?v=3","gravatar_id":"","url":"https://api.github.com/users/Allardvm","html_url":"https://github.com/Allardvm","followers_url":"https://api.github.com/users/Allardvm/followers","following_url":"https://api.github.com/users/Allardvm/following{/other_user}","gists_url":"https://api.github.com/users/Allardvm/gists{/gist_id}","starred_url":"https://api.github.com/users/Allardvm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Allardvm/subscriptions","organizations_url":"https://api.github.com/users/Allardvm/orgs","repos_url":"https://api.github.com/users/Allardvm/repos","events_url":"https://api.github.com/users/Allardvm/events{/privacy}","received_events_url":"https://api.github.com/users/Allardvm/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/JuliaLang/julia/labels/bug","name":"bug","color":"e10c02"},{"url":"https://api.github.com/repos/JuliaLang/julia/labels/I/O","name":"I/O","color":"baff00"},{"url":"https://api.github.com/repos/JuliaLang/julia/labels/parallel","name":"parallel","color":"f7e102"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2015-10-13T10:46:50Z","updated_at":"2015-10-16T07:36:15Z","closed_at":null,"body":"I encounter an error when using distributed processing as part of a simulation study. Following the `pmap` code, I use one master core to hand out tasks to a set of worker cores. Each worker processes a task and then returns some data in an array that the master writes to a file. Even with a single worker in addition to the master, I encounter the `EINVAL` error below when the return array is quite large (~ 2.4 GB). The array fits in the available memory (the machine has 16 GB, with over 9 GB available at the time of the error).\r\n\r\n```julia\r\nfatal error on 2: \r\nLoadError: ProcessExitedException()\r\nwhile loading In[3], in expression starting on line 155\r\n\r\n in yieldto at /Applications/Julia.app/Contents/Resources/julia/lib/julia/sys.dylib\r\n in wait at /Applications/Julia.app/Contents/Resources/julia/lib/julia/sys.dylib (repeats 3 times)\r\n in take! at /Applications/Julia.app/Contents/Resources/julia/lib/julia/sys.dylib (repeats 2 times)\r\n in remotecall_fetch at multi.jl:729\r\n in wrapper at In[2]:8\r\n\r\nERROR: write: invalid argument (EINVAL)\r\n in yieldto at /Applications/Julia.app/Contents/Resources/julia/lib/julia/sys.dylib\r\n in wait at /Applications/Julia.app/Contents/Resources/julia/lib/julia/sys.dylib\r\n in stream_wait at /Applications/Julia.app/Contents/Resources/julia/lib/julia/sys.dylib\r\n in uv_write at stream.jl:944\r\n in buffer_or_write at stream.jl:966\r\n in write at stream.jl:993\r\n in serialize_array_data at serialize.jl:164\r\n in serialize at serialize.jl:181\r\n in serialize at serialize.jl:418\r\n in send_msg_ at multi.jl:222\r\n in send_msg_now at multi.jl:173\r\n in deliver_result at multi.jl:808\r\n [inlined code] from multi.jl:893\r\n in anonymous at task.jl:892\r\nWorker 2 terminated.\r\nERROR (unhandled task failure): readcb: invalid argument (EINVAL)\r\n```\r\n\r\nThe following minimal working example reproduces the error on my Mac, but results in a slightly different error and backtrace on a similar Windows computer:\r\n\r\n```julia\r\naddprocs(1)\r\n\r\n@everywhere function testthis()\r\n    databuffer = zeros(300000000)\r\n    return databuffer\r\nend\r\n\r\nfunction wrapper()\r\n    for i_wpid in workers()\r\n        result = remotecall_fetch(i_wpid, testthis)\r\n    end\r\nend\r\n\r\nwrapper()\r\n```\r\n\r\nThe error does not occur when I omit the `addprocs(1)` in the above code.\r\n\r\nBelow my `versioninfo`, including memory information:\r\n\r\n```\r\nJulia Version 0.4.0\r\nCommit 0ff703b* (2015-10-08 06:20 UTC)\r\nPlatform Info:\r\n  System: Darwin (x86_64-apple-darwin13.4.0)\r\n  CPU: Intel(R) Core(TM) i7-4850HQ CPU @ 2.30GHz\r\n  WORD_SIZE: 64\r\n  uname: Darwin 15.0.0 Darwin Kernel Version 15.0.0: Wed Aug 26 16:57:32 PDT 2015; root:xnu-3247.1.106~1/RELEASE_X86_64 x86_64 i386\r\nMemory: 16.0 GB (9407.90625 MB free)\r\n```\r\n\r\nMy attempts to fix this have not been successful so far. Any help is greatly appreciated."},"comment":{"url":"https://api.github.com/repos/JuliaLang/julia/issues/comments/148638247","html_url":"https://github.com/JuliaLang/julia/issues/13578#issuecomment-148638247","issue_url":"https://api.github.com/repos/JuliaLang/julia/issues/13578","id":148638247,"user":{"login":"Allardvm","id":11735900,"avatar_url":"https://avatars.githubusercontent.com/u/11735900?v=3","gravatar_id":"","url":"https://api.github.com/users/Allardvm","html_url":"https://github.com/Allardvm","followers_url":"https://api.github.com/users/Allardvm/followers","following_url":"https://api.github.com/users/Allardvm/following{/other_user}","gists_url":"https://api.github.com/users/Allardvm/gists{/gist_id}","starred_url":"https://api.github.com/users/Allardvm/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Allardvm/subscriptions","organizations_url":"https://api.github.com/users/Allardvm/orgs","repos_url":"https://api.github.com/users/Allardvm/repos","events_url":"https://api.github.com/users/Allardvm/events{/privacy}","received_events_url":"https://api.github.com/users/Allardvm/received_events","type":"User","site_admin":false},"created_at":"2015-10-16T07:36:15Z","updated_at":"2015-10-16T07:36:15Z","body":"Looks like that may indeed cause the OSX issue, considering that your generic working example runs perfectly on Windows.\r\n\r\nHowever, there is still a related issue in here somewhere since my original working example (below) doesn't run correctly on Windows either. The code produces the `EINVAL` error reported above on OSX, but immediately triggers a BSOD on Windows (10). I just lost my debugging efforts when I tried to run the code. This also prevents me from providing a decent backtrace.\r\n```julia\r\naddprocs(1)\r\n\r\n@everywhere function testthis()\r\n    databuffer = zeros(300000000)\r\n    return databuffer\r\nend\r\n\r\nfunction wrapper()\r\n    for i_wpid in workers()\r\n        result = remotecall_fetch(i_wpid, testthis)\r\n    end\r\nend\r\n\r\nwrapper()\r\n```"}}