Is it an HSRP Bug?

Hi,
I have implemented HSRP betwen Cisco 1841 & Cisco 1700. and used Standby Track command.
1841>
interface FastEthernet0/0
ip address 10.4.0.2 255.255.252.0
duplex auto
speed auto
standby 1 ip 10.4.0.1
standby 1 priority 254
standby 1 preempt
standby 1 track Serial0/0/0 100
1751>
interface FastEthernet0/0
ip address 10.4.0.3 255.255.252.0
duplex auto
speed auto
standby 1 ip 10.4.0.1
standby 1 priority 250
The show standby Command on 1841 is as follows:
1841#show standby
FastEthernet0/0 - Group 1
State is Active
4 state changes, last state change 01:49:46
Virtual IP address is 10.4.0.1
Active virtual MAC address is 0000.0c07.ac01
Local virtual MAC address is 0000.0c07.ac01 (v1 default)
Hello time 3 sec, hold time 10 sec
Next hello sent in 0.244 secs
Preemption enabled
Active router is local
Standby router is 10.4.0.3, priority 250 (expires in 8.108 sec)
Priority 154 (configured 254)
Track interface Serial0/0/0 state Down decrement 100
IP redundancy name is "hsrp-Fa0/0-1" (default)
YB-MUMNP-P-1841#
I have made the serial 0/0/0 link down (not by Serial Shutdown command, but by switching off the link)
If you see, the priority of the 1841 router is 154, as compared to 250 of 1751,
Yet 1841 is Active router.
Is there somethin i hv missed, or the router is misbehaving?
rgds
Sumedh

Hi amit,
I was having the same dilemna while preparing for my BCMSN - CCNP exam :) Consider this scenario
Router A with HSRP priority 50 with no preempt configured
Router B with HSRP priority 25 with preempt enabled.
Assume router A is the first HSRP router on the LAN segment it becomes the default active forwarder and begins forwarding data. Now router B comes up and since it has preempt configured, it will preempt router A. However since it has lesser priority it will fail.
Assume router A fails (i.e the hold down timer expires after not recieving 3 consecutive hellos) now router B becomes the default active forwarder.
So far so good.
If router A comes back online, it will start sending hellos, but since it is NOT configured with the preempt command, router A will not set the preempt flag and hence router B will continue being the active forwarder until the time it actually goes down or an administrator manually does the needful.
Now if Router A was configured with standby preempt, Router A would correctly set the preempt flag and since it has higher priority it would correctly be set as the active forwarder once again
Hope I understood your problem correctly and gave the right explanation.

Similar Messages

  • Strange nexus behavior

        I'll try to explain this best i can .   We have  2 6509's  running port channels down to 2 Nexus 7000' where the 7000's are running vpc .  All the routing is still being done on the 6509's .   The nexus 7000's only have routing running via separate ospf links back to the 6509's . The plan is to eventually have the routing on the nexus so we have all the layer 3 SVI's that are on the 6509's defined on the 7000's  with hsrp but all are admin down on the 7000's for now.  On the 7000's all the routing looks correct with all the ip routes being learned on the separate ospf links.  This is the strange thing from the 7000's if try to ping  the svi addresses both the primary and secondary addresses on the 6509's they  ping fine but if you try to ping any hsrp virtual address none of those ping .  The really strange thing we see in the routing table on the 7000's  is that hsrp virtual  is put into the ospf table as a /32  with a source of the vlan that it is on on the 7000's which is admin'd down so obviously that traffic is not going to go anywhere if it's trying to send it down a admin down SVI  . The actual subnet that the SVI is in is a /24 .   So what we tried is we removed the downed svi on both 7000's and then cleared that /32  virtual address and it works correctly  and the route for that address looks correct being the ospf uplinks to the 6509's . I'm not sure what to make of it . Is there some inherent difference in the way the Nexus handles hsrp even if it's admin'd down?   Or can anyone explain this behavior .  I will add this if you stick a device in that vlan on  either the 7000's or a nexus 5000 which is below the 7000's configured with an address and the virtual address as the gateway  it rides the vpc's as it should up from the 5000's to the 7000's and up  to the 6509s .  You can also ping the hsrp virtual from this device . The problem just seems to be with the nexus 7000 and ospf  and the hsrp virtual address being in the table as a /32 pointing to a vlan which is admi'd down on the 7000's .  Strange.   Any speculation welcome...

      Well there seems to be at least 2 or 3 bugs that are fairly close to this so my guess is it is a bug .  Seems like there is more hsrp bugs than there should be on the Nexus platform.   The only problem with this is a "clear ip route *"  does not fix what we are seeing so we really don't have a fix for this issue.
    STP vPC: route still installed after no hsrp
    CSCuh07613
    Description
    Symptom:
    hsrp vip is down by "shutdown" or "no hsrp", but route still installed
    Conditions:
    - On a N7k running 6.2(2)/6.2(2a) when a new SVI is created and HSRP is configured.
    - disable hsrp by "no hsrp " or shutdown interface.
    Workaround:
    clear ip route *
    Further Problem Description:
    Customer Visible
    Was the description about this Bug Helpful?
    (0)
    Last Modified:
    Jan 2,2014
    Status:
    Fixed
    Severity:
    3 Moderate
    Product:
    Cisco Nexus 7000 Series Switches
    Support Cases:
    5
    Known Affected Releases:
    (2)
    6.2(1.111)S5
    6.2(2a)

  • WAAS and Routers running HSRP

    I am just in the process of deploying WAAS across our network. I have found that when the WAN router that is running WCCP has been configured for HSRP and is the active router i see the following
    If I try and telnet to the HSRP standby address it does not connect and I get the following error message :
    Jan 30 18:04:36.930 AU-Summ: %IP-3-LOOPPAK: Looping packet detected and dropped
    src=172.16.33.254, dst=172.16.9.251, hl=20, tl=72, prot=47, sport=0, dport=0
    in=GigabitEthernet0/0.9, nexthop=172.16.9.251, out=GigabitEthernet0/0.9
    options=none
    -Process= "IP Input", ipl= 0, pid= 82
    -Traceback= 0x611B33C0 0x616A0FD4 0x616A11E0 0x616A1C14 0x616A1FE4 0x6168D09C 0x
    6168E880 0x6168C384 0x6168C648 0x6168C704 0x6168C8A8
    f I telnet to the actual router address then ok.
    is this a Bug?

    just seen other question about HSRP and tried the
    "egress-method negotiated-return intercept-method wccp' command but made no difference
    see router interface configuration below
    Note if no HSRP then no problem
    interface Loopback0
    ip address 172.16.33.254 255.255.255.255
    interface GigabitEthernet0/0
    description trunk to Cat 6509
    bandwidth 100000
    no ip address
    duplex auto
    speed auto
    media-type rj45
    negotiation auto
    ntp broadcast
    interface GigabitEthernet0/0.1
    encapsulation dot1Q 1 native
    ip address 172.16.1.100 255.255.255.0
    no snmp trap link-status
    interface GigabitEthernet0/0.2
    encapsulation dot1Q 2
    ip address 172.16.2.250 255.255.255.0
    ip wccp 61 redirect in
    ip flow egress
    no snmp trap link-status
    interface GigabitEthernet0/0.3
    encapsulation dot1Q 3
    ip address 172.16.3.250 255.255.255.0
    ip wccp 61 redirect in
    no snmp trap link-status
    interface GigabitEthernet0/0.5
    encapsulation dot1Q 5
    ip address 172.16.5.252 255.255.255.0
    ip wccp 61 redirect in
    ip pim sparse-mode
    no snmp trap link-status
    standby 5 ip 172.16.5.254
    standby 5 preempt
    service-policy input prec
    interface GigabitEthernet0/0.6
    encapsulation dot1Q 6
    ip address 172.16.6.252 255.255.255.0
    ip helper-address 172.16.5.228
    ip accounting output-packets
    ip wccp 61 redirect in
    ip pim sparse-mode
    no snmp trap link-status
    standby 6 ip 172.16.6.254
    standby 6 preempt
    service-policy input prec
    interface GigabitEthernet0/0.7
    encapsulation dot1Q 7
    ip address 172.16.7.252 255.255.255.0
    ip helper-address 172.16.5.228
    ip wccp 61 redirect in
    ip pim sparse-mode
    no snmp trap link-status
    standby 7 ip 172.16.7.254
    standby 7 priority 105
    standby 7 preempt
    service-policy input prec
    interface GigabitEthernet0/0.9
    description testlan for WAAS
    encapsulation dot1Q 9
    ip address 172.16.9.254 255.255.255.0
    ip wccp redirect exclude in
    no snmp trap link-status

  • HSRP Bad Authentication

    Hi,
    I'm having the following message almost continously:
    %STANDBY-3-BADAUTH: Bad authentication from 103.226.1.249, remote state Init
    I have double checked the config and there's no authentication configured in neither of the switches of this HSRP group. Config is the following:
    SWITCH1:
    interface Vlan2
    ip address 31.226.1.249 255.255.255.0 secondary
    ip address 200.4.163.249 255.255.255.0 secondary
    ip address 103.226.1.249 255.255.255.0
    ip helper-address 103.197.4.3
    ip helper-address 47.193.27.3
    no ip redirects
    standby 2 ip 103.226.1.1
    standby 2 ip 31.226.1.1 secondary
    standby 2 ip 200.4.163.1 secondary
    standby 2 priority 120
    SWITCH 2:
    interface Port-channel1.2
    encapsulation dot1Q 2
    ip address 31.226.1.246 255.255.255.0 secondary
    ip address 200.4.163.246 255.255.255.0 secondary
    ip address 103.226.1.246 255.255.255.0
    ip helper-address 103.197.4.3
    ip helper-address 47.193.27.3
    no ip redirects
    no ip directed-broadcast
    standby 2 priority 130 preempt
    standby 2 ip 103.226.1.1
    standby 2 ip 31.226.1.1 secondary
    standby 2 ip 200.4.163.1 secondary
    This is the result of sh standby brief for switch 2:
    Po1.2 2 130 P Active local 103.226.1.249 103.226.1.1
    And this for switch 1:
    Interface Grp Prio P State Active Standby Virtual IP
    Vl2 2 120 Standby 103.226.1.246 local 103.226.1.1
    The device which complains of this error is cisco Cat4232L3 with IOS 12.0(7)W5(15b). Despite I'm pretty sure this is a bug, I have found nothing in the Bug Toolkit...
    What do you think?
    Regards,
    Ruben

    Ruben
    I do not see a problem with the part of the config that you posted. And the show standby indicates that HSRP is working (at least switch 2 knows that it is active and switch 1 knows that it is standby). I do not know if the full output of show standby would show anything else useful.
    If standby is working and you are getting these error messages then it does sound like a bug. If you want to investigate further, it might be helpful to run debug for HSRP and see if it indiates anything. And of course opening a case with TAC is the ultimate way to find if it is a bug.
    HTH
    Rick

  • CSCue18444 - A packet is unable to reach HSRP VIP in other VRF

    Hello,
    i'm confused about which release of NXOS for the 7k has fixed this issue.
    I have read the release notes for both release train 6.1 and 6.2 and the bug ID (CSCue18444) is not mentioned in there.
    I know that the bug search mentiones the following releases are the bug fixed in:
    5.2(9.115)S0
    6.1(4.37)S0
    6.2(1.59)S0
    6.2(1.93)
    7.0(0.7)
    6.1(5.2)S0
    Regards
    Jocke W

       We are experiencing a similiar type of condition on 7k NS/OS 6.1.(2). If a VLAN gets shut down on 7k1 (which is the peer), and HSRP for the VLAN becomes active on 7k2, everything is fine.  When the VLAN is unshut on 7k1 which then preempts and becomes the active HSRP peer again for the VLAN, the HSRP gateway IP is no longer in the ARP table on 7k2. This has caused issues when servers are using the path through 7k2 but can't find the gateway IP to go to the 7k1 peer. If we ping the HSRP gateway IP from the 7k2 VRF it resides in, the IP and corresponding MAC are restored in the ARP table on 7k2, and both paths are again working as expected. Could this be similiar to this bug? (Also posted this on bug id CSCuh7946 that I found referenced in release notes for for 6.2).  I'm also having issues finding resolution or specific references for this condition, and have also checked several other release notes. Another bug, CSCue54187 may also be similiar from - release notes for 5.2).
    Thank you,
    Lynn Morgan

  • Catalyst 3550 & HSRP v2

    Hi,
    I am testing on lab equipment (2 Catalyst 3550 and 1 Catalyst 3560) HSRP version 1 and 2.
    I successfully created a load balancing between the two Catalyst 3550 on a couple of vlans (11 and 12) on ver 1
    now, just adding the command "standby xx version 2" my hosts on the 2 vlans are completely unable to ping the virtual IP def. gw
    on debugging i checked that
    hello msgs are exchanged
    the two cat 3550 are seeing each other on HSRP (active / standby roles)
    the real ip addresses are pingable
    rebooted the swiches (just as a last resort try)
    deleted arp chache on hosts
    removed the auth on hsrp
    all of this no effect...
    i also tried to modify the priority on the cat 3560 (before he was on both vlans in standby) to make it the active one and with the same config it worked flawlessly...
    My only idea is that there is a bug on CATs 3550 (IOS: c3550-ipservicesk9-mz.122-55.SE4.bin)
    configs:
    SW-3550-A
    interface Vlan11
    ip address 12.0.0.2 255.255.255.0
    standby version 2
    standby 11 ip 12.0.0.1
    standby 11 priority 150
    standby 11 preempt
    standby 11 authentication md5 key-string LAB
    SW-3550-B
    interface Vlan11
    ip address 12.0.0.3 255.255.255.0
    standby version 2
    standby 11 ip 12.0.0.1
    standby 11 preempt
    standby 11 authentication md5 key-string LAB
    SW-3550-A#sh standby
    Vlan11 - Group 11 (version 2)
    State is Active
    16 state changes, last state change 00:18:08
    Virtual IP address is 12.0.0.1
    Active virtual MAC address is 0000.0c9f.f00b
    Local virtual MAC address is 0000.0c9f.f00b (v2 default)
    Hello time 3 sec, hold time 10 sec
    Next hello sent in 2.560 secs
    Authentication MD5, key-string
    Preemption enabled
    Active router is local
    Standby router is 12.0.0.3, priority 100 (expires in 8.976 sec)
    Priority 150 (configured 150)
    Group name is "hsrp-Vl11-11" (default)
    SW-3550-B#sh standby
    Vlan11 - Group 11 (version 2)
    State is Standby
    10 state changes, last state change 00:17:18
    Virtual IP address is 12.0.0.1
    Active virtual MAC address is 0000.0c9f.f00b
    Local virtual MAC address is 0000.0c9f.f00b (v2 default)
    Hello time 3 sec, hold time 10 sec
    Next hello sent in 2.208 secs
    Authentication MD5, key-string
    Preemption enabled
    Active router is 12.0.0.2, priority 150 (expires in 9.616 sec)
    MAC address is 000a.8a28.ea80
    Standby router is local
    Priority 100 (default 100)
    Group name is "hsrp-Vl11-11" (default)
    Any suggestion is appreciatedd and...thank you all in advance!

    Thank you for your answer,
    i have tried with groups 1 & 2 and 11 & 12
    VLAN
    GRP
    SW-3550-A
    SW-3550-B
    11
    11
    ACTIVE
    STANDBY
    12
    12
    STANDBY
    ACTIVE
    VLAN
    GRP
    SW-3550-A
    SW-3550-B
    11
    1
    ACTIVE
    STANDBY
    12
    2
    STANDBY
    ACTIVE
    I also tried to have just 1 group (1 or 11) and avoid a load-balance on hosts: same results.
    UPDATE:
    Tried with a couple of 1841: everything is working fine
    tried changing 3550s hsrpv2 groups to higher values (like 1111 & 1112 instead of 1 & 2) : no way
    still on the idea that is a 3550s bug...

  • ACE - show ft track detail - don't show 'hsrp' info

    Hi,
    I tried configure FT tracking by HSRP group configured on MSFC:
    ft track hsrp HSRP-01
    track-hsrp hsrp-Vl26-0
    priority 100
    peer priority 150
    and verify it:
    ace-lab/Admin# sh ft track ?
    <1-255> Please enter FT Group ID
    detail Display FT Track detail
    status Display FT Track status
    summary Display FT Track summary
    ace-lab/Admin# sh ft track detail
    FT Group : 1
    Status : in-service
    Maintenance mode : MAINT_MODE_OFF
    My State : FSM_FT_STATE_ACTIVE
    My Config Priority : 100
    My Net Priority : 100
    My Preempt : Enabled
    Context Name : FE
    Context Id : 5
    ...but I didn't get no information about 'hsrp'. by cisco documentation I'll get something like this:
    Track type : TRACK_HSRP
    HSRP Group Name : test
    State: TRACK_DOWN (HSRP Group is Standby on the Supervisor)
    Priority : 20
    Transitions : 1
    I did something wrong, or it's a bug? (I didn't find any bug with this symptoms)
    ACE version: Version 3.0(0)A1(3b)
    martin

    By the following example I am demonstrating tracking configuration for an HSRP group on the active member of an FT group.
    ft track hsrp TRACK_HSRP_GRP1
    track-hsrp HSRP_GRP1
    priority 50
    In the above configuration example, if the HSRP_GRP1 group goes down, the ACE reduces the priority of the FT group on the active member by 50. If at any time the priority of the FT group on the active member falls below the priority of the FT group on the standby member, a switchover occurs.

  • Index with "or" clause (BUG still exists?)

    The change log for 2.3.10 mentions "Fixed a bug that caused incorrect query plans to be generated for predicates that used the "or" operator in conjunction with indexes [#15328]."
    But looks like the Bug still exists.
    I am listing the steps to-repro. Let me know if i have missed something (or if the bug needs to be fixed)
    DATA
    dbxml> openContainer test.dbxml
    dbxml> getDocuments
    2 documents found
    dbxml> print
    <node><value>a</value></node>
    <node><value>b</value></node>
    INDEX (just one string equality index on node "value")
    dbxml> listIndexes
    Index: unique-node-metadata-equality-string for node {http://www.sleepycat.com/2002/dbxml}:name
    Index: node-element-equality-string for node {}:value
    2 indexes found.
    QUERY
    setVerbose 2 2
    preload test.dbxml
    query 'let $temp := fn:compare("test", "test") = 0
    let $results := for $i in collection("test.dbxml")
    where ($temp or $i/node[value = ("a")])
    return $i
    return <out>{$temp}{$results}</out>'
    When $temp is true i expected the result set to contain both the records, but that was not the case with the index. It works well when there is no index!
    Result WITH INDEX
    dbxml> print
    <out>true<node><value>a</value></node></out>
    Result WITHOUT INDEX
    dbxml> print
    <out>true<node><value>a</value></node><node><value>b</value></node></out>

    Hi Vijay,
    This is a completely different bug, relating to predicate expressions that do not examine nodes. Please try the following patch, to see if it fixes this bug for you:
    --- dbxml-2.3.10-original/dbxml/src/dbxml/optimizer/QueryPlanGenerator.cpp     2007-04-18 10:05:24.000000000 +0100
    +++ dbxml-2.3.10/dbxml/src/dbxml/optimizer/QueryPlanGenerator.cpp     2007-08-08 11:32:10.000000000 +0100
    @@ -1566,11 +1572,12 @@
         else if(name == Or::name) {
              UnionQP *unionOp = new (&memMgr_) UnionQP(&memMgr_);
    +          result.operation = unionOp;
              for(VectorOfASTNodes::iterator i = args.begin(); i != args.end(); ++i) {
                   PathResult ret = generate(*i, ids);
                   unionOp->addArg(ret.operation);
    +               if(ret.operation == 0) result.operation = 0;
    -          result.operation = unionOp;
         // These operators use the presence of the node arguments, not their valueJohn

  • Bug report follow-up

    is there a way to follow-up on a bug report that i submitted?  i have the bug number, but would like to see if the report was understood, filled out properly and determine the status of the bug report.
    thanks,
    doug

    They comment on bugs if actions were taken. Otherwise - don't expect any feedback.

  • Solaris8 and 9 (possibly 7) /dev/poll driver bug report.

    Hello,
    I'd like to report a bug in the solaris 8 and 9 /dev/poll driver (poll(7d)).
    As i do not have a support account with sun or anything like that, there
    seems to be no other way to do that here (which is of course a very sad
    thing).
    Bug details:
    The /dev/poll device provides an ioctl-request (DP_ISPOLLED) for checking
    if a particular filedescriptor is currently in the set of monitored
    filedescriptors for that particular /dev/poll fd set (open /dev/poll fd).
    A quote from the documentation of the poll(7d) manual page taken from
    Solaris9:
    "DP_ISPOLLED ioctl allows you to query if a file descriptor is already in
    the monitored set represented by fd. The fd field of the pollfd structure
    indicates the file descriptor of interest. The DP_ISPOLLED ioctl returns 1
    if the file descriptor is in the set. The events field contains the
    currently polled events. The revents field contains 0. The ioctl returns 0
    if the file descriptor is not in the set. The pollfd structure pointed by
    pfd is not modified. The ioctl returns a -1 if the call fails."
    It says that when you query for an filedescriptor which is currently being
    monitored in the set, that it would return 1, and change the events field of
    the pollfd structure to the events it's currently monitoring that fd for.
    The revents field would be set to zero.
    However the only thing which actually happens here, is that FD_ISPOLLED
    returns 1 when the fd is in the set and 0 if not. When the fd is in the
    set, when FD_ISPOLLED returns 1, the events field remains unmodified, but
    the revents field gets changed.
    A small sample code to illustrate:
    #include <stdio.h>
    #include <unistd.h>
    #include <sys/types.h>
    #include <sys/stat.h>
    #include <fcntl.h>
    #include <sys/devpoll.h>
    main() {
    struct pollfd a;
    int dp_fd = open("/dev/poll", O_WRONLY);
    a.fd = 0; /* stdin */
    a.events = POLLIN; /* we monitor for readability, POLLIN=1 */
    a.revents = 0;
    write(dp_fd, &a, sizeof(a));
    a.fd = 0;
    a.events = 34; /* filled in with bogus number to show malfunctioning */
    a.revents = 0;
    printf("DP_ISPOLLED returns: %d\n", ioctl(dp_fd, DP_ISPOLLED, &a));
    printf("a.fd=%d, a.events=%hd, a.revents=%hd\n", a.fd, a.events,
    a.revents);
    According to the documentation of /dev/poll and namely DP_ISPOLLED this
    program is supposed to print the following:
    DP_ISPOLLED returns: 1
    a.fd=0, a.events=1, a.revents=0
    However it prints the following:
    DP_ISPOLLED returns: 1
    a.fd=0, a.events=34, a.revents=1
    You can take any number instead of '34' and it will simply remain untouched
    after the DP_ISPOLLED ioctl-request.
    I hope it's clear now that the solaris8 and solaris9 (and probably solaris7
    with /dev/poll patch too) DP_ISPOLLED implementation is broken.
    This bug is also easily illustrated by looking at the solaris8 kernel sourcecode:
    <snippet osnet_volume/usr/src/uts/common/io/devpoll.c:dpioctl()>
    case DP_ISPOLLED:
    pollfd_t pollfd;
    polldat_t *pdp;
    if (pollfd.fd < 0) {
    mutex_exit(&pcp->pc_lock);
    break;
    pdp = pcache_lookup_fd(pcp, pollfd.fd);
    if ((pdp != NULL) && (pdp->pd_fd == pollfd.fd) &&
    (pdp->pd_fp != NULL)) {
    pollfd.revents = pdp->pd_events;
    if (copyout(&pollfd, (caddr_t)arg,
    sizeof(pollfd_t))) {
    mutex_exit(&pcp->pc_lock);
    DP_REFRELE(dpep);
    return (set_errno(EFAULT));
    *rvalp = 1;
    </snippet>
    its' clearly visible that the code writes the current monitored events to
    the revents field:
    'pollfd.revents = pdp->pd_events;'
    and that it doesnt set revents to zero.
    It's funny to see that this has been like this since Solaris8 (possibly 7). That means nobody ever used DP_ISPOLLED that way or people were simply to lazy to file a bug report.
    Another funny thing related to this. is that Hewlett-Packard did seem to know about this. Since HP-UX11i version 1.6 they also support /dev/poll. From their manual page i ll quote some sentences from their WARNING session:
    "The ioctl(DP_ISPOLLED) system call also returns its result in the revents member of the pollfd structure, in order to be compatible with the implementation of the /dev/poll driver by some other vendors."
    Hopefully this will get fixed.
    I also like to reexpress my very negative feelings towards the fact that you're not able to file bug reports when you do not have a support contract. Ridiculous.
    Thanks,
    bighawk

    Have I mentioned how much i love my playbook now Great job on os 2.0

  • [bdb bug]repeatly open and close db may cause memory leak

    my test code is very simple :
    char *filename = "xxx.db";
    char *dbname = "xxx";
    for( ; ;)
    DB *dbp;
    DB_TXN *txnp;
    db_create(&dbp,dbenvp, 0);
    dbenvp->txn_begin(dbenvp, NULL, &txnp, 0);
    ret = dbp->open(dbp, txnp, filename, dbname, DB_BTREE, DB_CREATE, 0);
    if(ret != 0)
    printf("failed to open db:%s\n",db_strerror(ret));
    return 0;
    txnp->commit(txnp, 0);
    dbp->close(dbp, DB_NOSYNC);
    I try to run my test program for a long time opening and closing db repeatly, then use the PS command and find the RSS is increasing slowly:
    ps -va
    PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND
    1986 pts/0 S 0:00 466 588 4999 980 0.3 -bash
    2615 pts/0 R 0:01 588 2 5141 2500 0.9 ./test
    after a few minutes:
    ps -va
    PID TTY STAT TIME MAJFL TRS DRS RSS %MEM COMMAND
    1986 pts/0 S 0:00 473 588 4999 976 0.3 -bash
    2615 pts/0 R 30:02 689 2 156561 117892 46.2 ./test
    I had read bdb's source code before, so i tried to debug it for about a week and found something like a bug:
    If open a db with both filename and dbname, bdb will open a db handle for master db and a db handle for subdb,
    both of the two handle will get an fileid by a internal api called __dbreg_get_id, however, just the subdb's id will be
    return to bdb's log region by calling __dbreg_pop_id. It leads to a id leak if I tried to open and close the db
    repeatly, as a result, __dbreg_add_dbentry will call realloc repeatly to enlarge the dbentry area, this seens to be
    the reason for RSS increasing.
    Is it not a BUG?
    sorry for my pool english :)
    Edited by: user9222236 on 2010-2-25 下午10:38

    I have tested my program using Oracle Berkeley DB release 4.8.26 and 4.7.25 in redhat 9.0 (Kernel 2.4.20-8smp on an i686) and AIX Version 5.
    The problem is easy to be reproduced by calling the open method of db handle with both filename and dbname being specified and calling the close method.
    My program is very simple:
    #include <stdlib.h>
    #include <stdio.h>
    #include <sys/time.h>
    #include "db.h"
    int main(int argc, char * argv[])
    int ret, count;
    DB_ENV *dbenvp;
    char * filename = "test.dbf";
    char * dbname = "test";
    db_env_create(&dbenvp, 0);
    dbenvp->open(dbenvp, "/home/bdb/code/test/env",DB_CREATE|DB_INIT_LOCK|DB_INIT_LOG|DB_INIT_TXN|DB_INIT_MPOOL, 0);
    for(count = 0 ; count < 10000000 ; count++)
    DB *dbp;
    DB_TXN *txnp;
    db_create(&dbp,dbenvp, 0);
    dbenvp->txn_begin(dbenvp, NULL, &txnp, 0);
    ret = dbp->open(dbp, txnp, filename, dbname, DB_BTREE, DB_CREATE, 0);
    if(ret != 0)
    printf("failed to open db:%s\n",db_strerror(ret));
    return 0;
    txnp->commit(txnp, 0);
    dbp->close(dbp, DB_NOSYNC);
    dbenvp->close(dbenvp, 0);
    return 0;
    DB_CONFIG is like below:
    set_cachesize 0 20000 0
    set_flags db_auto_commit
    set_flags db_txn_nosync
    set_flags db_log_inmemory
    set_lk_detect db_lock_minlocks
    Edited by: user9222236 on 2010-2-28 下午5:42
    Edited by: user9222236 on 2010-2-28 下午5:45

  • Multiple return values (Bug-ID 4222792)

    I had exactly the same request for the same 3 reasons: strong type safety and code correctness verification at compile-time, code readability and ease of mantenance, performance.
    Here is what Sun replied to me:
    Autoboxing and varargs are provided as part of
    JSRs 14 and 201
    http://jcp.org/en/jsr/detail?id=14
    http://jcp.org/en/jsr/detail?id=201
    See also:
    http://forum.java.sun.com/forum.jsp?forum=316
    http://developer.java.sun.com/developer/earlyAccess/adding_generics/index.html
    Multiple return values is covered by Bug-ID 4222792
    Typically this is done by returning an array.
    http://developer.java.sun.com/developer/bugParade/bugs/4222792.html
    That's exactly the problem: we dynamically create instances of array objects that would better fit well within the operand stack without stressing the garbage collector with temporary Array object instances (and with their backing store: 2 separate allocations that need to be recycled when it is clearly a pollution that the operand stack would clean up more efficiently)
    If you would like to engage in a discussion with the Java Language developers, the Generics forum would be a better place:
    http://forum.java.sun.com/forum.jsp?forum=316
    I know that (my report was already refering to the JSR for language extension) Generics is not what I was refering to (even if a generic could handle multiple return values, it would still be an allocated Object
    instance to pack them, i.e. just less convenient than using a static class for type safety.
    The most common case of multiple return values involve values that have known static datatypes and that should be checked with strong typesafety.
    The simple case that involves returning two ints then will require at least two object instances and will not solve the garbage collection overhead.
    Using a array of variable objects is exactly similar, except that it requires two instances for the components and one instance for the generic array container. Using extra method parameters with Integer, Byte, ... boxing objects is more efficient, but for now the only practical solution (which causes the least pollution in the VM allocator and garbage collector) is to use a custom class to store the return values in a single instance.
    This is not natural, and needlessly complexifies many interfaces.
    So to avoid this pollution, some solutions are used such as packing two ints into a long and returning a long, depacking the long after return (not quite clean but still much faster at run-time for methods that need to be used with high frequencies within the application. In some case, the only way to cut down the overhead is to inline methods within the caller code, and this does not help code maintenance by splitting the implementation into small methods (something that C++ can do very easily, both because it supports native types parameters by reference, and because it also supports inline methods).
    Finally, suppose we don't want to use tricky code, difficult to maintain, then we'll have to use boxing Object types to allow passing arguments by reference. Shamely boxed native types cannot be allocated on the operand stack as local variables, so we need to instanciate these local variables before call, and we loose the capacity to track the cases where these local variables are not really initialized by an effective call to the method that will assign them. This does not help debugging, and is against the concept of a strongly typed language like Java should be:
    Java makes lots of efforts to track uninitialized variables, but has no way to determine if an already instanciated Object instance refered in a local variable has effectively received an effective assignment because only the instanciation is kept. A typical code will then need to be written like this:
    Integer a = null;
    Integer b = null;
    if (some condition) {
    //call.method(a, b, 0, 1, "dummy input arg");
    // the method is supposed to have assigned a value to a and b,
    // but can't if a and b have not been instanciated, so we perform:
    call.method(a = new Integer(), b = new Integer(), 0, 1, "dummy input
    arg");
    // we must suppose that the method has modified (not initialized!)
    the value
    // of a and b instances.
    now.use(a.value(), b.value())
    // are we sure here that a and b have received a value????
    // the code may be detected at run-time (a null exception)
    // or completely undetected (the method() above was called but it
    // forgot to assign a value to its referenced objects a and b, in which
    // case we are calling in fact: now.use(0, 0); with the default values
    // or a and b, assigned when they were instanciated)
    Very tricky... Hard to debug. It would be much simpler if we just used:
    int a;
    int b;
    if (some condition) {
    (a, b) = call.method(0, 1, "dummy input arg");
    now.use(a, b);
    The compiler would immediately detect the case where a and b are in fact not always initialized (possible use bere initialization), and the first invoked call.method() would not have to check if its arguments are not null, it would not compile if it forgets to return two values in some code path...
    There's no need to provide extra boxing objects in the source as well as at run-time, and there's no stress added to the VM allocator or garbage collector simply because return values are only allocated on the perand stack by the caller, directly instanciated within the callee which MUST (checked at compile-time) create such instances by using the return statement to instanciate them, and the caller now just needs to use directly the variables which were referenced before call (here a and b). Clean and mean. And it allows strong typechecking as well (so this is a real help for programmers.
    Note that the signature of the method() above is:
    class call {
    (int, int) method(int, int, String) { ... }
    id est:
    class "call", member name "method", member type "(IILjava.lang.string;)II"
    This last signature means that the method can only be called by returning the value into a pair of variables of type int, or using the return value as a pair of actual arguments for another method call such as:
    call.method(call.method("dummy input arg"), "other dummy input arg")
    This is strongly typed and convenient to write and debug and very efficient at run-time...

    Can anyone give me some real-world examples where
    multiple return values aren't better captured in a
    class that logically groups those values? I can of
    course give hundreds of examples for why it's better
    to capture method arguments as multiple values instead
    of as one "logical object", but whenever I've hankered
    for multiple return values, I end up rethinking my
    strategy and rewriting my code to be better Object
    Oriented.I'd personally say you're usually right. There's almost always a O-O way of avoiding the situation.
    Sometimes though, you really do just want to return "two ints" from a function. There's no logical object you can think of to put them in. So you end up polluting the namespace:
    public class MyUsefulClass {
    public TwoInts calculateSomething(int a, int b, int c) {
    public static class TwoInts {
        //now, do I use two public int fields here, making it
        //in essence a struct?
       //or do I make my two ints private & final, which
       //requires a constructor & two getters?
      //and while I'm at it, is it worth implementing
      //equals(), how about hashCode()? clone()?
      //readResolve() ?
    }The answer to most of the questions for something as simple as "TwoInts" is usually "no: its not worth implementing those methods", but I still have to think about them.
    More to the point, the TwoInts class looks so ugly polluting the top level namespace like that, MyUsefulClass.TwoInts is public, that I don't think I've ever actually created that class. I always find some way to avoid it, even if the workaround is just as ugly.
    For myself, I'd like to see some simple pass-by-value "Tuple" type. My fear is it'd be abused as a way for lazy programmers to avoid creating objects when they should have a logical type for readability & maintainability.
    Anyone who has maintained code where someone has passed in all their arguments as (mutable!) Maps, Collections and/or Arrays and "returned" values by mutating those structures knows what a nightmare it can be. Which I suppose is an argument that cuts both ways: on the one hand you can say: "why add Tuples which would be another easy thing to abuse", on the other: "why not add Tuples, given Arrays and the Collections framework already allow bad programmers to produce unmainable mush. One more feature isn't going to make a difference either way".
    Ho hum.

  • Extensions like Ghostery, WOT or AdBlock stop working after two or three times. Restarting the webpage in a new tab the extensions will work again for several times and then stop again. Has anybody an explanation or a workaround for this bug in Safari 5?

    Extensions like Ghostery, WOT or AdBlock stop working after two or three times. Restarting the webpage in a new tab the extensions will work again for several times and then stop again. Has anybody an explanation or a workaround for this bug in Safari 5?

    Remove the extensions, redownload Safari, reload the extensions.
    http://www.apple.com/safari/download/
    And if you really want a better experience, use Firefox, tons more choices and possibilities there.
    Firefox's "NoScript" will block the Trojan going around on websites. Best web security you can get.
    https://addons.mozilla.org/en-US/firefox/addon/noscript/
    Ghostery, Ad Block Plus and thousands of add-ons more have originated on Firefox.

  • Bug? My events on the iPad iCal app aren't shown in the year view if they are more than two years in the future.

    My events on the iPad iCal app aren't shown in the year view if they are more than two years in the future even though I can see them on the month, week and day view. Any suggestions on how to fix it? I've tried it all. I called the apple support and they checked on their iPads. They all did the same and they couldn't help me. They suggested trying this way. I'd like to be able to plan a few years ahead and the year view would make thing so easy!
    Is this a bug?

    Go to the Home screen and double click the Home button. That will reveal the row of recently used apps at the bottom of the screen. Tap and hold on the app in question until it wiggles and displays a minus sign. Tap the minus sign to actually quit the app. Then tap anywhere on the screen above that bottom row to return the screen to normal. Then restart the app and see if it works normally.
    Then reboot your iPad. Press and hold the Home and Sleep buttons simultaneously ignoring the red slider until the Apple logo appears. Let go of the buttons and let the iPad restart. See if that fixes your problem.

  • HT4528 My IPhone Bugged out/It is currently in the reset mode. I need to exchange all of my contacts from my Yahoo acct. to my new IPHONE. Can you please help me?

    Hello ,
    I purchased my IPHONE about 2 months ago. I am visiting family in DE & this tuesday it starting to go off & on by itself. Then the icons looked like they were floating . Then I could not call or text . The SIRI device would not work. Then it would shut down then the apple icon would reappear. I took it to a verizon dealer in Rehoboth DE & they said it BUGGED OUT/It is in a RESTORE MODE. It will not turn on. We could not transfer anny of my pics or contacts. I never even had a chance to back up the memory on ITUNES.
    The tech @ Verizon said to contact APPLE to trouble shoot and try and transfer the contacts from my yahoo acct.
    Can you please help?
    Gina

    set up your yahoo account in mail, contacts, calendars as an Exchange Account and you should be able to get your contacts from Yahoo from there.

Maybe you are looking for