Bug 634014

Summary: Large persistent messages cause seg fault
Product: Red Hat Enterprise MRG Reporter: Mike Cressman <mcressma>
Component: qpid-cppAssignee: Kim van der Riet <kim.vdriet>
Status: CLOSED ERRATA QA Contact: Jeff Needle <jneedle>
Severity: high Docs Contact:
Priority: high    
Version: 1.2CC: gsim, jneedle, tao, vdanen
Target Milestone: 1.2.2   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
C: sending a large (> 11 MB) persistent message to a queue C: the broker gets a seg fault F: changed to a more robust memory allocation scheme R: memory is now successfully allocated allowing large persistent messages to be sent
Story Points: ---
Clone Of: Environment:
Last Closed: 2010-10-08 01:50:31 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 640006    
Attachments:
Description Flags
Patch which replaces alloca() with std::vector<char>() none

Description Mike Cressman 2010-09-14 22:11:09 UTC
Description of problem:
Sending a large (> 11 MB) persistent message to the broker results in a seg fault for the broker.

Version-Release number of selected component (if applicable):
RHEL 5.4
MRG 1.2

How reproducible:
Always

Steps to Reproduce:
1. Start broker with staging-threshold=0 (to avoid other known issues)
2. Run 'perftest --count 1 --size 11000000 --durable yes'
3. Broker will seg fault
  
Actual results:
Broker will seg fault without completing the operation.

Expected results:
Message processed successfully

Additional info:

Comment 1 Mike Cressman 2010-09-14 22:12:31 UTC
This is 1.2 only, works fine with 1.3

Comment 2 Kim van der Riet 2010-09-15 19:21:32 UTC
Created attachment 447552 [details]
Patch which replaces alloca() with std::vector<char>()

The use of ::alloca() to allocate memory from the stack for a message encode buffer is efficient for small messages, but for large messages (>10MB) this can corrupt the stack. The crash occurs when attempting to encode into a buffer allocated using ::alloca(size) and size > 10MB.

I have replaced this with a std::vector<char>() instead and tested it with 100MB-sized messages.

Patch is attached.

Comment 3 Kim van der Riet 2010-09-15 19:24:15 UTC
Note that this patch must be applied *after* the existing mrg_1.2-el5.patch.

Comment 7 Mike Cressman 2010-09-24 15:08:59 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
C: sending a large (> 11 MB) persistent message to a queue
C: the broker gets a seg fault
F: changed to a more robust memory allocation scheme
R: memory is now successfully allocated allowing large persistent messages to be sent

Comment 13 errata-xmlrpc 2010-10-08 01:50:31 UTC
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.

http://rhn.redhat.com/errata/RHSA-2010-0756.html