[AGENT++] crash in Vb::set_value

Frank Fock fock at agentpp.com
Wed Jan 5 21:50:37 CET 2005


Hello Marin,

the stack you posted is not really helpful to locate the problem.
I guess that there is a synchronization problem in your instrumentation
code somewhere. Do you update the value of the leaf in question
externally? Is this call synchronized?

The MibLeaf::get_value() method returns the Vbx by value (copy).
So there could not be a potential memory access problem.

Hope this help.

Best regards,
Frank

Loridon, Martin wrote:

>Hello all,
>
> 
>
>Sometimes my (multi-threaded) agent running on a Win32 platform in VC++6.0
>debug environment crashes. (access violation)
>
>This happens when I try to change a MibLeaf value. See the code parts below
>gathered from snmp++ sources.
>
>agent++ version is 3.5.19 and snmp++ 3.2.13
>
> 
>
>/**
>
>   * Get the value of the receiver.
>
>   * 
>
>   * @param i - A reference to a long the receiver's value will be copied
>in.  
>
>   * @return SNMP_ERROR_SUCCESS on success.
>
>   */
>
>  virtual int                    get_value(long& i) const 
>
>                                                             { return
>get_value().get_value(i); }
>
> 
>
> 
>
> 
>
> 
>
>Vbx MibLeaf::get_value() const
>
>{
>
>            Vbx vb(get_oid());
>
>            if (value)
>
>                        vb.set_value(*value);
>
> 
>
>            return vb;
>
>}
>
> 
>
>  /**
>
>   * Set the value using any SnmpSyntax object.
>
>   */
>
>  void set_value(const SnmpSyntax &val)
>
>    { free_vb(); iv_vb_value = val.clone(); };
>
> 
>
>169:    void set_value(const SnmpSyntax &val)
>
>170:      { free_vb(); iv_vb_value = val.clone(); };
>
>004240B0   push        ebp
>
>004240B1   mov         ebp,esp
>
>004240B3   sub         esp,44h
>
>004240B6   push        ebx
>
>004240B7   push        esi
>
>004240B8   push        edi
>
>004240B9   push        ecx
>
>004240BA   lea         edi,[ebp-44h]
>
>004240BD   mov         ecx,11h
>
>004240C2   mov         eax,0CCCCCCCCh
>
>004240C7   rep stos    dword ptr [edi]
>
>004240C9   pop         ecx
>
>004240CA   mov         dword ptr [ebp-4],ecx
>
>004240CD   mov         ecx,dword ptr [ebp-4]
>
>004240D0   call        Vb::free_vb (0042dc40)
>
>004240D5   mov         eax,dword ptr [ebp+8]
>
>004240D8   mov         edx,dword ptr [eax]
>
>004240DA   mov         esi,esp
>
>004240DC   mov         ecx,dword ptr [ebp+8]
>
>004240DF   call        dword ptr [edx+8]
>
>004240E2   cmp         esi,esp
>
>004240E4   call        __chkesp (004b8d70)
>
>004240E9   mov         ecx,dword ptr [ebp-4]
>
>004240EC   mov         dword ptr [ecx+14h],eax
>
>004240EF   pop         edi
>
>004240F0   pop         esi
>
>004240F1   pop         ebx
>
>004240F2   add         esp,44h
>
>004240F5   cmp         ebp,esp
>
>004240F7   call        __chkesp (004b8d70)
>
>004240FC   mov         esp,ebp
>
>004240FE   pop         ebp
>
>004240FF   ret         4
>
>004240DF   call        dword ptr [edx+8] edx register contains rubbish
>
>I wonder if this could have something to do with the return of vb in Vbx
>MibLeaf::get_value() const
>
>which is in fact a local variable and also be destructed by leaving the
>function.
>
>Is this a bug or am I wrong?
>
>Martin Loridon 
>Software Development Engineer 
>Barco Digital Cinema 
>Noordlaan 5 
>B-8520 Kuurne, Belgium 
>Tel:  +32 (0)56 36 87 17 
>Fax: +32 (0)56 36 88 62 
>mailto:martin.loridon at barco.com <mailto:martin.loridon at barco.com>  
>www.d-cine.barco.com 
>www.barco.com 
>
> 
>
>- - - - - - - DISCLAIMER - - - - - - - - 
>Unless indicated otherwise, the information contained in this message is
>privileged and confidential, and is intended only for the use of the
>addressee(s) named above and others who have been specifically authorized to
>receive it. If you are not the intended recipient, you are hereby notified
>that any dissemination, distribution or copying of this message and/or
>attachments is strictly prohibited. The company accepts no liability for any
>damage caused by any virus transmitted by this email. Furthermore, the
>company does not warrant a proper and complete transmission of this
>information, nor does it accept liability for any delays. If you have
>received this message in error, please contact the sender and delete the
>message. Thank you.
>_______________________________________________
>AGENTPP mailing list
>AGENTPP at agentpp.org
>http://agentpp.org/mailman/listinfo/agentpp
>
>  
>





More information about the AGENTPP mailing list