{"action":"created","issue":{"url":"https://api.github.com/repos/crate/crate/issues/2234","labels_url":"https://api.github.com/repos/crate/crate/issues/2234/labels{/name}","comments_url":"https://api.github.com/repos/crate/crate/issues/2234/comments","events_url":"https://api.github.com/repos/crate/crate/issues/2234/events","html_url":"https://github.com/crate/crate/issues/2234","id":93742472,"number":2234,"title":"COPY TO S3 bucket does not work","user":{"login":"wnkz","id":533849,"avatar_url":"https://avatars.githubusercontent.com/u/533849?v=3","gravatar_id":"","url":"https://api.github.com/users/wnkz","html_url":"https://github.com/wnkz","followers_url":"https://api.github.com/users/wnkz/followers","following_url":"https://api.github.com/users/wnkz/following{/other_user}","gists_url":"https://api.github.com/users/wnkz/gists{/gist_id}","starred_url":"https://api.github.com/users/wnkz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wnkz/subscriptions","organizations_url":"https://api.github.com/users/wnkz/orgs","repos_url":"https://api.github.com/users/wnkz/repos","events_url":"https://api.github.com/users/wnkz/events{/privacy}","received_events_url":"https://api.github.com/users/wnkz/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-08T09:17:23Z","updated_at":"2015-07-09T11:37:03Z","closed_at":"2015-07-09T11:37:03Z","body":"I think there is an issue with the `COPY TO` command when writing in an S3 bucket.\r\nUsing Crate `0.49.4` on Docker with a 3 nodes cluster.\r\nHere is an example:\r\n\r\n```sql\r\ncr> create table t (id integer primary key, label string) ;\r\nCREATE OK (1.031 sec)\r\ncr> insert into t (id, label) values (0, 'zero'), (1, 'one'), (2, 'two') ;\r\nINSERT OK, 3 rows affected (0.101 sec)\r\ncr> COPY t TO DIRECTORY 's3://my-bucket/crate/test' ;\r\n_\r\n```\r\n\r\nAnd then the query hangs forever.\r\n\r\nNow, here is what's created on S3:\r\n\r\n```shell\r\n> aws s3 ls s3://my-bucket/crate/test/                                                                                                                    \r\n2015-07-08 10:17:39          0 t_0_.json\r\n2015-07-08 10:17:43          0 t_4_.json\r\n```\r\n\r\nSo the \"folders\" are properly created, some files too but they remain empty.\r\n\r\nHere are the crate logs (this error is repeated multiple times on slaves nodes):\r\n\r\n```\r\n[2015-07-08 08:17:34,775][INFO ][com.amazonaws.http.AmazonHttpClient] x-amzn-RequestId: not available\r\n[2015-07-08 08:17:34,808][INFO ][com.amazonaws.http.AmazonHttpClient] AWS Request ID: 96276505845335C7\r\n[2015-07-08 08:18:04,845][INFO ][com.amazonaws.http.AmazonHttpClient] Unable to execute HTTP request: my-bucket.s3.amazonaws.com failed to respond\r\norg.apache.http.NoHttpResponseException: my-bucket.s3.amazonaws.com failed to respond\r\n\tat org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:143)\r\n\tat org.apache.http.impl.conn.DefaultHttpResponseParser.parseHead(DefaultHttpResponseParser.java:57)\r\n\tat org.apache.http.impl.io.AbstractMessageParser.parse(AbstractMessageParser.java:260)\r\n\tat org.apache.http.impl.AbstractHttpClientConnection.receiveResponseHeader(AbstractHttpClientConnection.java:283)\r\n\tat org.apache.http.impl.conn.DefaultClientConnection.receiveResponseHeader(DefaultClientConnection.java:251)\r\n\tat org.apache.http.impl.conn.ManagedClientConnectionImpl.receiveResponseHeader(ManagedClientConnectionImpl.java:197)\r\n\tat org.apache.http.protocol.HttpRequestExecutor.doReceiveResponse(HttpRequestExecutor.java:271)\r\n\tat com.amazonaws.http.protocol.SdkHttpRequestExecutor.doReceiveResponse(SdkHttpRequestExecutor.java:66)\r\n\tat org.apache.http.protocol.HttpRequestExecutor.execute(HttpRequestExecutor.java:123)\r\n\tat org.apache.http.impl.client.DefaultRequestDirector.tryExecute(DefaultRequestDirector.java:685)\r\n\tat org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:487)\r\n\tat org.apache.http.impl.client.AbstractHttpClient.doExecute(AbstractHttpClient.java:863)\r\n\tat org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)\r\n\tat org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:57)\r\n\tat com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:701)\r\n\tat com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:462)\r\n\tat com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:297)\r\n\tat com.amazonaws.services.s3.AmazonS3Client.invoke(AmazonS3Client.java:3672)\r\n\tat com.amazonaws.services.s3.AmazonS3Client.doUploadPart(AmazonS3Client.java:2808)\r\n\tat com.amazonaws.services.s3.AmazonS3Client.uploadPart(AmazonS3Client.java:2793)\r\n\tat io.crate.operation.projectors.writer.OutputS3$S3OutputStream.close(OutputS3.java:174)\r\n\tat io.crate.operation.projectors.writer.OutputS3.close(OutputS3.java:72)\r\n\tat io.crate.operation.projectors.WriterProjector.endProjection(WriterProjector.java:166)\r\n\tat io.crate.operation.projectors.WriterProjector.finish(WriterProjector.java:199)\r\n\tat io.crate.operation.collect.LuceneDocCollector.doCollect(LuceneDocCollector.java:238)\r\n\tat io.crate.operation.collect.MapSideDataCollectOperation.doCollect(MapSideDataCollectOperation.java:425)\r\n\tat io.crate.operation.collect.MapSideDataCollectOperation.access$000(MapSideDataCollectOperation.java:77)\r\n\tat io.crate.operation.collect.MapSideDataCollectOperation$2$1.run(MapSideDataCollectOperation.java:414)\r\n\tat java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)\r\n\tat java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)\r\n\tat java.lang.Thread.run(Thread.java:745)\r\n```\r\n\r\n<bountysource-plugin>\r\n---\r\nWant to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/23925223-copy-to-s3-bucket-does-not-work?utm_campaign=plugin&utm_content=tracker%2F505659&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F505659&utm_medium=issues&utm_source=github).\r\n</bountysource-plugin>"},"comment":{"url":"https://api.github.com/repos/crate/crate/issues/comments/119922697","html_url":"https://github.com/crate/crate/issues/2234#issuecomment-119922697","issue_url":"https://api.github.com/repos/crate/crate/issues/2234","id":119922697,"user":{"login":"mfussenegger","id":38700,"avatar_url":"https://avatars.githubusercontent.com/u/38700?v=3","gravatar_id":"","url":"https://api.github.com/users/mfussenegger","html_url":"https://github.com/mfussenegger","followers_url":"https://api.github.com/users/mfussenegger/followers","following_url":"https://api.github.com/users/mfussenegger/following{/other_user}","gists_url":"https://api.github.com/users/mfussenegger/gists{/gist_id}","starred_url":"https://api.github.com/users/mfussenegger/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mfussenegger/subscriptions","organizations_url":"https://api.github.com/users/mfussenegger/orgs","repos_url":"https://api.github.com/users/mfussenegger/repos","events_url":"https://api.github.com/users/mfussenegger/events{/privacy}","received_events_url":"https://api.github.com/users/mfussenegger/received_events","type":"User","site_admin":false},"created_at":"2015-07-09T11:37:02Z","updated_at":"2015-07-09T11:37:02Z","body":"Thanks for reporting.\r\n\r\nSeems we haven't used the S3 API correctly and invoked it in a way that could lead to an infinite loop somewhere in the AWS SDK.\r\nI think it worked fine for files that were > 5MB (but haven't confirmed that).\r\n\r\nAnyway, a fix for this is in master (https://github.com/crate/crate/pull/2250) and will also be part of the next hotfix releases"}}