>On Tue, Apr 08, 2014 at 03:51:33AM +0000, Yinpeijun wrote:
>> Hello everyone, Recently, I use openvswitch-2.0.0 to test send packets 
>> between the vms, duration the test I use valgrind to
>> 
>> catch if there is memory leak in ovs-vswitched process , after test I see 
>> the valgrind log as follow :
>> 
>> ==12453== Invalid read of size 8
>> ==12453==    at 0x424B06: handle_flow_misses (ofproto-dpif.c:3501)
>> ==12453==    by 0x425A3A: handle_upcalls (ofproto-dpif.c:3632)
>> ==12453==    by 0x425C7D: type_run_fast (ofproto-dpif.c:1041)
>> ==12453==    by 0x412651: ofproto_type_run_fast (ofproto.c:1332)
>> ==12453==    by 0x406AC4: bridge_run_fast (bridge.c:2384)
>> ==12453==    by 0x40D8ED: main (ovs-vswitchd.c:117)
>> ==12453==  Address 0x8122820 is 1,120 bytes inside a block of size 1,144 
>> free'd
>> ==12453==    at 0x4C263F0: free (vg_replace_malloc.c:446)
>> ==12453==    by 0x424948: handle_flow_misses (ofproto-dpif.c:4599)
>> ==12453==    by 0x425A3A: handle_upcalls (ofproto-dpif.c:3632)
>> ==12453==    by 0x425C7D: type_run_fast (ofproto-dpif.c:1041)
>> ==12453==    by 0x412651: ofproto_type_run_fast (ofproto.c:1332)
>> ==12453==    by 0x406AC4: bridge_run_fast (bridge.c:2384)
>> ==12453==    by 0x40D8ED: main (ovs-vswitchd.c:117)
>> 
>> ==12453== Invalid write of size 4
>> ==12453==    at 0x424B41: handle_flow_misses (ofproto-dpif.c:3507)
>> ==12453==    by 0x425A3A: handle_upcalls (ofproto-dpif.c:3632)
>> ==12453==    by 0x425C7D: type_run_fast (ofproto-dpif.c:1041)
>> ==12453==    by 0x412651: ofproto_type_run_fast (ofproto.c:1332)
>> ==12453==    by 0x406AC4: bridge_run_fast (bridge.c:2384)
>> ==12453==    by 0x40D8ED: main (ovs-vswitchd.c:117)
>> ==12453==  Address 0x8122828 is 1,128 bytes inside a block of size 1,144 
>> free'd
>> ==12453==    at 0x4C263F0: free (vg_replace_malloc.c:446)
>> ==12453==    by 0x424948: handle_flow_misses (ofproto-dpif.c:4599)
>> ==12453==    by 0x425A3A: handle_upcalls (ofproto-dpif.c:3632)
>> ==12453==    by 0x425C7D: type_run_fast (ofproto-dpif.c:1041)
>> ==12453==    by 0x412651: ofproto_type_run_fast (ofproto.c:1332)
>> ==12453==    by 0x406AC4: bridge_run_fast (bridge.c:2384)
>> ==12453==    by 0x40D8ED: main (ovs-vswitchd.c:117)
>> 
>> then I find the code as follow:
>> 
>>     if (list_is_empty(&facet->subfacets)) {
>>         subfacet = &facet->one_subfacet;
>>     } else {
>>         subfacet = subfacet_find(backer, key, key_len, key_hash);
>>         if (subfacet) {
>>             if (subfacet->facet == facet) {
>>                 return subfacet;
>>             }
>> 
>>             /* This shouldn't happen. */
>>             VLOG_ERR_RL(&rl, "subfacet with wrong facet");
>>             subfacet_destroy(subfacet);
>>         }
>> So , I should annotation or delete the code above? Any advice on this 
>> would be greatly appreciated.
>
>This is certainly a bug that should be fixed, but I'm having trouble matching 
>up the line numbers in the valgrind output above with the code that you 
>quoted.  What are the line numbers for the code you quoted above?  Are you 
>using exactly the openvswitch 2.0.0 release, 
>or a different release, or a modified version of some release?

Thank you for your reply Ben. 
sorry for my mistake ,I exactly use a openvswitch 2.0.0 release but I have 
added some our own code, and the valgrind output above match the line numbers 
as follow:

3465  static void
3466  handle_flow_misses(struct dpif_backer *backer, struct flow_miss_batch 
*fmb)
3467  {
3468    struct flow_miss_op flow_miss_ops[FLOW_MISS_MAX_BATCH];
3469    struct dpif_op *dpif_ops[FLOW_MISS_MAX_BATCH];
3470    struct flow_miss *miss;
        size_t n_ops, i;

                /* Process each element in the to-do list, constructing the set 
of
        * operations to batch. */
        n_ops = 0;
        HMAP_FOR_EACH (miss, hmap_node, &fmb->misses) {
                handle_flow_miss(miss, flow_miss_ops, &n_ops);
        }
                ...........

3487     for (i = 0; i < n_ops; i++) {
.......          ............
3501          if (subfacet->dp_packet_count || subfacet->dp_byte_count) {
3502                VLOG_ERR_RL(&rl, "failed to install subfacet for which "
3503                            "datapath reported hits");
3504                subfacet->dp_packet_count = subfacet->dp_byte_count = 0;
3505            }
3506
3507            subfacet->path = SF_NOT_INSTALLED;
3508        }
3509    }

4576  static struct subfacet *
4577  subfacet_create(struct facet *facet, struct flow_miss *miss)
4578  {
4579     struct dpif_backer *backer = miss->ofproto->backer;
4580     enum odp_key_fitness key_fitness = miss->key_fitness;
         const struct nlattr *key = miss->key;
         .......
         if (list_is_empty(&facet->subfacets)) {
                subfacet = &facet->one_subfacet;
......           } else {
                subfacet = subfacet_find(backer, key, key_len, key_hash);
                if (subfacet) {
                if (subfacet->facet == facet) {
                         return subfacet;
                }
4596
4597            /* This shouldn't happen. */
4598            VLOG_ERR_RL(&rl, "subfacet with wrong facet");
4599            subfacet_destroy(subfacet);
        }
        ........


so , I want to know how to fix it ? Look forward to your reply

thanks







_______________________________________________
discuss mailing list
discuss@openvswitch.org
http://openvswitch.org/mailman/listinfo/discuss

Reply via email to