{ "id": "122797", "key": "TIMOB-15792", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "15972", "description": "Release 3.4.0", "name": "Release 3.4.0", "archived": false, "released": true, "releaseDate": "2014-09-28" } ], "resolution": { "id": "3", "description": "The problem is a duplicate of an existing issue.", "name": "Duplicate" }, "resolutiondate": "2014-07-31T21:03:57.000+0000", "created": "2013-11-22T10:58:00.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [ { "id": "14613", "description": "Release 2.1.4", "name": "Release 2.1.4", "archived": true, "released": true, "releaseDate": "2012-11-12" }, { "id": "15479", "description": "Release 3.1.2", "name": "Release 3.1.2", "archived": true, "released": true, "releaseDate": "2013-07-31" } ], "issuelinks": [ { "id": "39477", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "outwardIssue": { "id": "121690", "key": "TIMOB-15594", "fields": { "summary": "Android: base64 encode of a large file fails", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-23T05:24:32.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10202", "name": "Android", "description": "Android Platform" } ], "description": "h2. Problem description\r\nTrying to upload a big base64 string using an HTTPClient request fails due to memory error. The string has been generated using the code below, in order to avoid the memory error while encoding (see TIMOB-15594).\r\n\r\nh2. Code used to encode\r\n{code}\r\nvar stream = Ti.Filesystem.openStream(Ti.Filesystem.MODE_READ, SOME_FILE);\r\n \r\nvar buffer = Ti.createBuffer({\r\n length: 300 // must be multiple of 3\r\n});\r\n \r\nvar converted = \"\";\r\nvar len = 0;\r\nwhile((len = stream.read(buffer)) != -1) {\r\n buffer.length = len;\r\n converted += Ti.Utils.base64encode(buffer.toBlob());\r\n buffer.clear();\r\n}\r\n{code}\r\n\r\nh2. Error log while sending the base64 string with HTTPClient\r\n{code}\r\n11-21 11:19:16.986: E/dalvikvm-heap(30261): Out of memory on a 4782893-byte allocation.\r\n11-21 11:19:16.986: I/dalvikvm(30261): \"TiHttpClient-2\" prio=1 tid=16 RUNNABLE\r\n11-21 11:19:16.986: I/dalvikvm(30261): | group=\"main\" sCount=0 dsCount=0 obj=0x43a379a0 self=0x5e64a230\r\n11-21 11:19:16.986: I/dalvikvm(30261): | sysTid=2355 nice=19 sched=0/0 cgrp=apps/bg_non_interactive handle=1596774976\r\n11-21 11:19:16.991: I/dalvikvm(30261): | schedstat=( 215870373 20054584 25 ) utm=21 stm=0 core=3\r\n11-21 11:19:16.991: I/dalvikvm(30261): at java.nio.charset.Charsets.toUtf8Bytes(Native Method)\r\n11-21 11:19:16.991: I/dalvikvm(30261): at java.lang.String.getBytes(String.java:861)\r\n11-21 11:19:16.991: I/dalvikvm(30261): at java.lang.String.getBytes(String.java:845)\r\n11-21 11:19:16.991: I/dalvikvm(30261): at org.apache.http.entity.StringEntity.(StringEntity.java:64)\r\n11-21 11:19:16.991: I/dalvikvm(30261): at ti.modules.titanium.network.TiHTTPClient.handleURLEncodedData(TiHTTPClient.java:1247)\r\n11-21 11:19:16.991: I/dalvikvm(30261): at ti.modules.titanium.network.TiHTTPClient.access$2000(TiHTTPClient.java:99)\r\n11-21 11:19:16.991: I/dalvikvm(30261): at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1164)\r\n11-21 11:19:16.991: I/dalvikvm(30261): at java.lang.Thread.run(Thread.java:856)\r\n11-21 11:19:16.991: E/TiHttpClient(30261): (TiHttpClient-2) [24623,676845] HTTP Error (java.lang.OutOfMemoryError): java.lang.OutOfMemoryError\r\n11-21 11:19:16.991: E/TiHttpClient(30261): java.lang.OutOfMemoryError\r\n11-21 11:19:16.991: E/TiHttpClient(30261): at java.nio.charset.Charsets.toUtf8Bytes(Native Method)\r\n11-21 11:19:16.991: E/TiHttpClient(30261): at java.lang.String.getBytes(String.java:861)\r\n11-21 11:19:16.991: E/TiHttpClient(30261): at java.lang.String.getBytes(String.java:845)\r\n11-21 11:19:16.991: E/TiHttpClient(30261): at org.apache.http.entity.StringEntity.(StringEntity.java:64)\r\n11-21 11:19:16.991: E/TiHttpClient(30261): at ti.modules.titanium.network.TiHTTPClient.handleURLEncodedData(TiHTTPClient.java:1247)\r\n11-21 11:19:16.991: E/TiHttpClient(30261): at ti.modules.titanium.network.TiHTTPClient.access$2000(TiHTTPClient.java:99)\r\n11-21 11:19:16.991: E/TiHttpClient(30261): at ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1164)\r\n11-21 11:19:16.991: E/TiHttpClient(30261): at java.lang.Thread.run(Thread.java:856)\r\n11-21 11:19:16.991: I/TiHttpClient(30261): (TiHttpClient-2) [1,676846] Sending error java.lang.OutOfMemoryError\r\n{code}", "attachment": [ { "id": "44198", "filename": "testfile_5MB", "author": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-11-26T11:42:05.000+0000", "size": 5242880, "mimeType": "application/octet-stream" } ], "flagged": false, "summary": "Android: uploading a large base64 encoded file with HTTPClient crashes due to memory error", "creator": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "dcassenti", "key": "dcassenti", "displayName": "Davide Cassenti", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Android 4.1\r\nAndroid 4.2\r\nSDK 2.1.4\r\nSDK 3.1.2\r\n", "closedSprints": [ { "id": 154, "state": "closed", "name": "2014 Sprint 15 SDK", "startDate": "2014-07-21T21:56:31.515Z", "endDate": "2014-08-02T00:00:00.000Z", "completeDate": "2014-08-04T21:03:51.067Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "287218", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "I'm not able to find a maximum size hardcoded. My feeling is that it would either be limited by device memory or a server setting.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-01-08T17:47:54.000+0000", "updated": "2014-01-08T17:47:54.000+0000" }, { "id": "292663", "author": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "body": "This may be a duplicate of TIMOB-15594.", "updateAuthor": { "name": "sunila", "key": "sunila", "displayName": "Sunila", "active": true, "timeZone": "Asia/Kolkata" }, "created": "2014-02-12T13:39:18.000+0000", "updated": "2014-02-12T13:39:18.000+0000" }, { "id": "415244", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as duplicate with reference to the linked issues above.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-23T05:24:32.000+0000", "updated": "2017-03-23T05:24:32.000+0000" } ], "maxResults": 11, "total": 11, "startAt": 0 } } }