Portstatus example is not working

Hi,

I am trying to execute portstatus example provided in the example directory /examples.confd/dp/find_next

it stopped at this point in make start
TRACE Picked up old user session: 1 for user:system ctx:system

steps follwed:

  1. make clean
    rm -rf
    *.o *.a *.xso *.fxs *.xsd *.ccl
    _proto.h
    ./confd-cdb .db aaa_cdb.
    rollback
    /rollback{0…999} rollback{0…999}
    host.key host.cert ssh-keydir
    .log confderr.log.
    etc .access
    running.invalid global.data _tmp

    rm -rf ports.h portstatus 2> /dev/null || true

  2. make all
    /opt/confd//bin/confdc --fail-on-warnings -c -o ports.fxs ports.yang
    /opt/confd//bin/confdc --emit-h ports.h ports.fxs
    cc -c -o portstatus.o portstatus.c -Wall -g -I/opt/confd//include -DLinux
    cc -o portstatus portstatus.o /opt/confd//lib/libconfd.a -lpthread -lm
    mkdir -p ./confd-cdb
    cp /opt/confd//var/confd/cdb/aaa_init.xml ./confd-cdb
    ln -s /opt/confd//etc/confd/ssh ssh-keydir
    Build complete

  3. root@mars01> make start

Killing any confd daemon and portstatus daemon

/opt/confd//bin/confd --stop || true
killall portstatus || true
portstatus: no process found
/opt/confd//bin/confd -c confd.conf --addloadpath /opt/confd//etc/confd

* In another terminal window, run queries

(try ‘make query’ for an example)

* In this window, the portstatus daemon now starts:

./portstatus
TRACE Connected (maapi) to ConfD
TRACE MAAPI_LOAD_ALL_NS
TRACE MAAPI_LOAD_HASH_DB
TRACE Connected (dp) to ConfD
TRACE Received daemon id 0
TRACE Connected (dp) to ConfD
TRACE Picked up old user session: 10 for user:system ctx:system
TRACE Picked up old user session: 1 for user:system ctx:system

stuck up at poll system call -> (poll(set, sizeof(set)/sizeof(set[0]), -1) < 0)

Added timeout for 5secs and it went on polling for every 5 secs.

Can anyone tell us whats the problem here.
And this had worked for the first time, from second time onwards this problem is seen.

Thanks in Advance

The old user session message indicates that your portstatus daemon has reconnected to a ConfD daemon that is already running.

Try “make stop” to stop the confd daemon and run “confd --status” to insure that the confd daemon is indeed no longer running. Then run “make clean all start” to start the entire project again and see if this works.

Hi,

I followed the above mentioned steps, but its the same problem.

  1. make stop

Killing any confd daemon and portstatus daemon

/opt/confd//bin/confd --stop || true
killall portstatus || true
portstatus: no process found

  1. confd --status
    connection refused (status)

  2. make clean all start
    rm -rf
    *.o *.a *.xso *.fxs *.xsd *.ccl
    _proto.h
    ./confd-cdb .db aaa_cdb.
    rollback
    /rollback{0…999} rollback{0…999}
    host.key host.cert ssh-keydir
    .log confderr.log.
    etc .access
    running.invalid global.data _tmp

    rm -rf ports.h portstatus 2> /dev/null || true
    /opt/confd//bin/confdc --fail-on-warnings -c -o ports.fxs ports.yang
    /opt/confd//bin/confdc --emit-h ports.h ports.fxs
    cc -c -o portstatus.o portstatus.c -Wall -g -I/opt/confd//include -DLinux
    cc -o portstatus portstatus.o /opt/confd//lib/libconfd.a -lpthread -lm
    mkdir -p ./confd-cdb
    cp /opt/confd//var/confd/cdb/aaa_init.xml ./confd-cdb
    ln -s /opt/confd//etc/confd/ssh ssh-keydir
    Build complete

Killing any confd daemon and portstatus daemon

/opt/confd//bin/confd --stop || true
connection refused (stop)
killall portstatus || true
portstatus: no process found
/opt/confd//bin/confd -c confd.conf --addloadpath /opt/confd//etc/confd

* In another terminal window, run queries

(try ‘make query’ for an example)

* In this window, the portstatus daemon now starts:

./portstatus
TRACE Connected (maapi) to ConfD
TRACE MAAPI_LOAD_ALL_NS
TRACE MAAPI_LOAD_HASH_DB
TRACE Connected (dp) to ConfD
TRACE Received daemon id 0
TRACE Connected (dp) to ConfD
TRACE Picked up old user session: 10 for user:system ctx:system
TRACE Picked up old user session: 1 for user:system ctx:system

You didn’t include the above error message the second time around, I assume it came up again.

Did you have to start a CLI or NETCONF session in order for the error message to come up?

To help with debugging, can you modify confd.conf to add the following:

<logs>
  <developerLogLevel>trace</developerLogLevel>
  ...
</logs>

Rerun the project after the above is modified and include the output from devel.log.

output from devel.log

24-May-2016::00:42:03.297 mars01 confd[7755]: confd embedded apps in early_phase0: []
24-May-2016::00:42:03.437 mars01 confd[7755]: confd embedded apps in phase0: []
24-May-2016::00:42:03.635 mars01 confd[7755]: devel-cdb init files found in ./confd-cdb: aaa_init.xml
24-May-2016::00:42:03.661 mars01 confd[7755]: confd commit progress db=running usid=4 thandle=-2: entering validate phase for running…
24-May-2016::00:42:03.661 mars01 confd[7755]: confd commit progress db=running usid=4 thandle=-2: validate: grabbing transaction lock…
24-May-2016::00:42:03.661 mars01 confd[7755]: confd commit progress db=running usid=4 thandle=-2: ok
24-May-2016::00:42:03.664 mars01 confd[7755]: confd commit progress db=running usid=4 thandle=-2: validate: pre validate…
24-May-2016::00:42:03.667 mars01 confd[7755]: confd commit progress db=running usid=4 thandle=-2: ok
24-May-2016::00:42:03.668 mars01 confd[7755]: confd commit progress db=running usid=4 thandle=-2: validate: run validation over the change set…
24-May-2016::00:42:03.668 mars01 confd[7755]: confd commit progress db=running usid=4 thandle=-2: validate: validation over the change set done
24-May-2016::00:42:03.669 mars01 confd[7755]: confd commit progress db=running usid=4 thandle=-2: validate: run dependency-triggered validation…
24-May-2016::00:42:03.671 mars01 confd[7755]: confd commit progress db=running usid=4 thandle=-2: validate: dependency-triggered validation done
24-May-2016::00:42:03.671 mars01 confd[7755]: confd commit progress db=running usid=4 thandle=-2: entering write phase for running…
24-May-2016::00:42:03.671 mars01 confd[7755]: confd commit progress db=running usid=4 thandle=-2: cdb: write_start
24-May-2016::00:42:03.674 mars01 confd[7755]: confd commit progress db=running usid=4 thandle=-2: entering prepare phase for running…
24-May-2016::00:42:03.674 mars01 confd[7755]: confd commit progress db=running usid=4 thandle=-2: cdb: prepare
24-May-2016::00:42:03.674 mars01 confd[7755]: confd commit progress db=running usid=4 thandle=-2: entering commit phase for running…
24-May-2016::00:42:03.674 mars01 confd[7755]: confd commit progress db=running usid=4 thandle=-2: cdb: commit
24-May-2016::00:42:03.715 mars01 confd[7755]: devel-cdb Compacted CDB journal file: 19 ms (87 nodes in memory, disk size 1.43 KiB -> 1.39 KiB)
24-May-2016::00:42:03.721 mars01 confd[7755]: confd embedded apps in phase1: []
24-May-2016::00:42:03.823 mars01 confd[7755]: devel-aaa Module “tailf-webui” in access rule “any-group/tailf-webui-user” does not exist - ignoring rule
24-May-2016::00:42:03.824 mars01 confd[7755]: devel-cdb Loaded AAA data from CDB
24-May-2016::00:42:03.828 mars01 confd[7755]: confd embedded apps in phase2: []
24-May-2016::00:42:03.911 mars01 confd[7755]: devel-c New daemon connected (name: portstatus, daemon id: 0)
24-May-2016::00:42:03.911 mars01 confd[7755]: devel-c New worker connected (daemon id: 0 worker id: 4)

The output from your devel.log looks fine at this point. The poll call inside of main( ) in the portstatus daemon should be waiting for the file descriptions to become ready to perform I/O. Is this wait that is happening what you meant by “stuck up”?

Can you do a “make query” in a separate window?

yeah… this is the output of make query

  1. make query
    /opt/confd//bin/netconf-console --get -x ‘/port[slot>2]/status’
<?xml version="1.0" encoding="UTF-8"?>
<rpc-reply xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="1">
  <data>
    <port xmlns="http://tail-f.com/ns/example/ports">
      <slot>4</slot>
      <port>0</port>
      <status>error</status>
    </port>
    <port xmlns="http://tail-f.com/ns/example/ports">
      <slot>4</slot>
      <port>2</port>
      <status>disabled</status>
    </port>
  </data>
</rpc-reply>

Based on your NETCONF query output, the example is working as expected. Let us know if you have further questions.

yes… when i do make query and do show port i am getting the output.

how does this differ from normal flow, like
make clean
make all
make start
show port
why the above sequence won’t work. ?

The same procedure will also work with what you are calling the normal flow as shown in the following output:

localhost:find_next $ make clean all start
rm -rf \
            *.o *.a *.xso *.fxs *.xsd *.ccl \
            *_proto.h \
            ./confd-cdb *.db aaa_cdb.* \
            rollback*/rollback{0..999} rollback{0..999} \
            host.key host.cert ssh-keydir \
            *.log confderr.log.* \
            etc *.access \
            running.invalid global.data _tmp*
rm -rf ports.h portstatus 2> /dev/null || true
$CONFD_DIR/bin/confdc --fail-on-warnings  -c -o ports.fxs  ports.yang
$CONFD_DIR/bin/confdc --emit-h ports.h ports.fxs
cc -c -o portstatus.o portstatus.c -Wall -g -I$CONFD_DIR/include -I/opt/local/include -DDarwin
cc -o portstatus portstatus.o  $CONFD_DIR/lib/libconfd.a -lpthread -lm -L/opt/local/lib
mkdir -p ./confd-cdb
cp $CONFD_DIR/var/confd/cdb/aaa_init.xml ./confd-cdb
ln -s $CONFD_DIR/etc/confd/ssh ssh-keydir
Build complete
### Killing any confd daemon and portstatus daemon
$CONFD_DIR/bin/confd --stop || true
killall portstatus || true
No matching processes belonging to you were found
$CONFD_DIR/bin/confd -c confd.conf --addloadpath $CONFD_DIR/etc/confd
### * In another terminal window, run queries
###   (try 'make query' for an example)
### * In this window, the portstatus daemon now starts:
./portstatus
TRACE Connected (maapi) to ConfD
TRACE MAAPI_LOAD_ALL_NS
TRACE MAAPI_LOAD_HASH_DB
TRACE Connected (dp) to ConfD
TRACE Received daemon id 0
TRACE Connected (dp) to ConfD
TRACE Picked up old user session: 10 for user:system ctx:system
TRACE Picked up old user session: 1 for user:system ctx:system
^Z
[1]+  Stopped                 make clean all start
localhost:find_next waitai1$ bg
[1]+ make clean all start &
localhost:find_next $ make cli-c
$CONFD_DIR/bin/confd_cli --user=admin --groups=admin \
            --interactive || echo Exit

Welcome to ConfD Basic

The CLI may only be used during product development.
Commercial use of the CLI is prohibited.
You must disable the CLI in confd.conf for production.
For more information, visit http://www.tail-f.com.
admin connected from 127.0.0.1 using console on localhost
localhost# show port
SLOT  PORT  STATUS
----------------------
1     0     disabled
1     1     active
1     2     error
2     1     disabled
2     2     active
4     0     error
4     2     disabled

localhost#

Based on the discussion of this thread so far, the symptom of your problem is still not very clear. Can you expand on what you are actually experiencing and the accompanied devel.log output with the trace level enabled?