[jira] [Assigned] (PROTON-892) pn_data_t capacity does not grow above 32768 items
[ https://issues.apache.org/jira/browse/PROTON-892?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Robbie Gemmell reassigned PROTON-892: - Assignee: Alan Conway Assigning to Alan as requested in http://mail-archives.apache.org/mod_mbox/qpid-proton/201505.mbox/%3C1432734537.2993.118.camel%40redhat.com%3E pn_data_t capacity does not grow above 32768 items -- Key: PROTON-892 URL: https://issues.apache.org/jira/browse/PROTON-892 Project: Qpid Proton Issue Type: Improvement Components: proton-c Affects Versions: 0.9, 0.9.1, 0.10 Reporter: Michael Assignee: Alan Conway Priority: Minor Attachments: 0003-data-capacity.patch pn_data_grow() function looses half of the available data capacity. The following happens: when data overflows, pn_data_grow is invoked. It increases data capacity 2 times and reallocates nodes array. Data capacity is represented as uint16_t type and so when capacity reaches 32768 items, the result of multiplication by 2 becomes 0. This makes realloc return null and crashes the program. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (PROTON-892) pn_data_t capacity does not grow above 32768 items
[ https://issues.apache.org/jira/browse/PROTON-892?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14705380#comment-14705380 ] Alan Conway commented on PROTON-892: Not a regression so I moved it to 0.11. pn_data_t capacity does not grow above 32768 items -- Key: PROTON-892 URL: https://issues.apache.org/jira/browse/PROTON-892 Project: Qpid Proton Issue Type: Bug Components: proton-c Affects Versions: 0.9, 0.9.1, 0.10 Reporter: Michael Assignee: Alan Conway Fix For: 0.11 Attachments: 0003-data-capacity.patch pn_data_grow() function looses half of the available data capacity. The following happens: when data overflows, pn_data_grow is invoked. It increases data capacity 2 times and reallocates nodes array. Data capacity is represented as uint16_t type and so when capacity reaches 32768 items, the result of multiplication by 2 becomes 0. This makes realloc return null and crashes the program. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Updated] (PROTON-892) pn_data_t capacity does not grow above 32768 items
[ https://issues.apache.org/jira/browse/PROTON-892?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ] Alan Conway updated PROTON-892: --- Fix Version/s: (was: 0.10.1) 0.11 pn_data_t capacity does not grow above 32768 items -- Key: PROTON-892 URL: https://issues.apache.org/jira/browse/PROTON-892 Project: Qpid Proton Issue Type: Bug Components: proton-c Affects Versions: 0.9, 0.9.1, 0.10 Reporter: Michael Assignee: Alan Conway Fix For: 0.11 Attachments: 0003-data-capacity.patch pn_data_grow() function looses half of the available data capacity. The following happens: when data overflows, pn_data_grow is invoked. It increases data capacity 2 times and reallocates nodes array. Data capacity is represented as uint16_t type and so when capacity reaches 32768 items, the result of multiplication by 2 becomes 0. This makes realloc return null and crashes the program. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
Re: Final (maybe) proposal for C++ binding memory management.
On Thu, 2015-08-20 at 14:44 -0400, aconway wrote: Here's the API doc, the code is coming. It is like previous proposals which were well received but more correct. It has *two* conversion types, pn_borrowed_ptr and pn_given_ptr. This both automates the refcounting for smart pointers and acts as hard documentation of the ownership rules for plain pointers. Conversion types like this are not a new idea - CORBA used to have something like it. Small linguistic quibble: given goes with lent taken goes with borrowed (or maybe owned is better than taken?) (Your suggested names are confused about whether they are from the API implementation or client side) Andrew
[jira] [Commented] (PROTON-892) pn_data_t capacity does not grow above 32768 items
[ https://issues.apache.org/jira/browse/PROTON-892?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14705234#comment-14705234 ] Alan Conway commented on PROTON-892: Thanks a lot Michael. I had to adjust a bit for changes in proton, I made 2 actual changes to your solution: I defined PNI_NID_MAX. The problem with -1L is it makes assumptions about the signedness and bit size of pni_nid_t far away from the definition. It is correct in the code as it is today, but if someone changed pni_nid_t to a signed type, or a type bigger than long (and note size_t is not *guaranteed* to fit in a long on all platforms) it would create a subtle, rare, platform-specific bug. I dropped the case where you grow by adding 1k and stuck to a simple double till you hit the max. I don't see a reason to change algorithmic growth algorithm just because you passed 32k. Thanks again! pn_data_t capacity does not grow above 32768 items -- Key: PROTON-892 URL: https://issues.apache.org/jira/browse/PROTON-892 Project: Qpid Proton Issue Type: Bug Components: proton-c Affects Versions: 0.9, 0.9.1, 0.10 Reporter: Michael Assignee: Alan Conway Fix For: 0.10.1 Attachments: 0003-data-capacity.patch pn_data_grow() function looses half of the available data capacity. The following happens: when data overflows, pn_data_grow is invoked. It increases data capacity 2 times and reallocates nodes array. Data capacity is represented as uint16_t type and so when capacity reaches 32768 items, the result of multiplication by 2 becomes 0. This makes realloc return null and crashes the program. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (PROTON-892) pn_data_t capacity does not grow above 32768 items
[ https://issues.apache.org/jira/browse/PROTON-892?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14705248#comment-14705248 ] Robbie Gemmell commented on PROTON-892: --- Alan, can you change this to the 0.11 fix-for, or pick it onto to the 0.10.x branch with cherry-pick -x. pn_data_t capacity does not grow above 32768 items -- Key: PROTON-892 URL: https://issues.apache.org/jira/browse/PROTON-892 Project: Qpid Proton Issue Type: Bug Components: proton-c Affects Versions: 0.9, 0.9.1, 0.10 Reporter: Michael Assignee: Alan Conway Fix For: 0.10.1 Attachments: 0003-data-capacity.patch pn_data_grow() function looses half of the available data capacity. The following happens: when data overflows, pn_data_grow is invoked. It increases data capacity 2 times and reallocates nodes array. Data capacity is represented as uint16_t type and so when capacity reaches 32768 items, the result of multiplication by 2 becomes 0. This makes realloc return null and crashes the program. -- This message was sent by Atlassian JIRA (v6.3.4#6332)
[jira] [Commented] (PROTON-892) pn_data_t capacity does not grow above 32768 items
[ https://issues.apache.org/jira/browse/PROTON-892?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanelfocusedCommentId=14705212#comment-14705212 ] ASF subversion and git services commented on PROTON-892: Commit 0ca6ba7e261d82ac490ef0ea411d7a6e37de4591 in qpid-proton's branch refs/heads/master from [~aconway] [ https://git-wip-us.apache.org/repos/asf?p=qpid-proton.git;h=0ca6ba7 ] PROTON-892: pn_data_t capacity does not grow above 32768 items Fixed the bug and added a unit test to verify. pn_data_t capacity does not grow above 32768 items -- Key: PROTON-892 URL: https://issues.apache.org/jira/browse/PROTON-892 Project: Qpid Proton Issue Type: Bug Components: proton-c Affects Versions: 0.9, 0.9.1, 0.10 Reporter: Michael Assignee: Alan Conway Attachments: 0003-data-capacity.patch pn_data_grow() function looses half of the available data capacity. The following happens: when data overflows, pn_data_grow is invoked. It increases data capacity 2 times and reallocates nodes array. Data capacity is represented as uint16_t type and so when capacity reaches 32768 items, the result of multiplication by 2 becomes 0. This makes realloc return null and crashes the program. -- This message was sent by Atlassian JIRA (v6.3.4#6332)