[Kea-users] Hook Libraries logging not Initialized

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[Kea-users] Hook Libraries logging not Initialized

Joe Wilner
Hi -- 

I'm attempting to build a docker container of Kea 1.4.0 and hitting an issue around logging initialization when attempting to load hook libraries.

The relevant bits of the Dockerfile:
```
FROM ubuntu:18.04

RUN apt-get update && apt-get install -y --no-install-recommends libtool autoconf g++ libssl-dev liblog4cplus-dev libboost-system-dev

WORKDIR /build/

  && mkdir kea && tar -C kea --strip-components=1 -xzf kea.tar.gz \
  && cd kea && ./configure --enable-shell --enable-static-link \
  && make -j $(getconf _NPROCESSORS_ONLN) -l $(getconf _NPROCESSORS_ONLN) && make install \
  && cd /build/ \
  && rm -r kea*
  && ldconfig
```

When I run `kea-dhcp4` with the following config:
```
{
    "Dhcp4": {
            "hooks-libraries": [{
                "library": "/usr/local/lib/hooks/libdhcp_lease_cmds.so"
            }],
            "control-socket": {
                "socket-type": "unix",
                "socket-name": "/tmp/kea-dhcp4-ctrl.sock"
            },
            "lease-database": {
                ...
            },
            "expired-leases-processing": {
                ...
            },
            ...
    },
    "Logging": {
            "loggers": [
            {
                "name": "kea-dhcp4",
                "output_options": [
                { "output": "stdout" }
                ],
                "severity": "INFO",
                "debuglevel": 0
            }
            ]
        }
}
```

I get an error as follows:
```
2019-01-22 20:44:22.375 ERROR [kea-dhcp4.hooks/142] HOOKS_LOAD_FRAMEWORK_EXCEPTION 'load' function in hook library /usr/local/lib/hooks/libdhcp_lease_cmds.so threw an exception: reason attempt to access logging function before logging has been initialized
2019-01-22 20:44:22.375 ERROR [kea-dhcp4.hooks/142] HOOKS_UNLOAD_FRAMEWORK_EXCEPTION 'unload' function in hook library /usr/local/lib/hooks/libdhcp_lease_cmds.so threw an exception, reason attempt to access logging function before logging has been initialized
2019-01-22 20:44:22.375 ERROR [kea-dhcp4.dhcp4/142] DHCP4_PARSER_COMMIT_FAIL parser failed to commit changes: One or more hook libraries failed to load
2019-01-22 20:44:22.376 ERROR [kea-dhcp4.dhcp4/142] DHCP4_CONFIG_LOAD_FAIL configuration error using file: /usr/local/etc/kea/kea-dhcp4.conf, reason: One or more hook libraries failed to load
2019-01-22 20:44:22.376 ERROR [kea-dhcp4.dhcp4/142] DHCP4_INIT_FAIL failed to initialize Kea server: configuration error using file '/usr/local/etc/kea/kea-dhcp4.conf': One or more hook libraries failed to load
```

My instinct is that this is an issue with the linking but `ldconfig -p` looks as I would expect. 

Any advice or help would be appreciated.

Thanks,
Joe

_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users
Reply | Threaded
Open this post in threaded view
|

Re: [Kea-users] Hook Libraries logging not Initialized

Joe Wilner
Hi --

I was able to avoid this problem by dropping the `--enable-static-link`, so, as far as I can tell, there is an issue using the hook libraries with the statically linked binary.

Thanks,
Joe 

On Tue, Jan 22, 2019 at 3:55 PM Joe Wilner <[hidden email]> wrote:
Hi -- 

I'm attempting to build a docker container of Kea 1.4.0 and hitting an issue around logging initialization when attempting to load hook libraries.

The relevant bits of the Dockerfile:
```
FROM ubuntu:18.04

RUN apt-get update && apt-get install -y --no-install-recommends libtool autoconf g++ libssl-dev liblog4cplus-dev libboost-system-dev

WORKDIR /build/

  && mkdir kea && tar -C kea --strip-components=1 -xzf kea.tar.gz \
  && cd kea && ./configure --enable-shell --enable-static-link \
  && make -j $(getconf _NPROCESSORS_ONLN) -l $(getconf _NPROCESSORS_ONLN) && make install \
  && cd /build/ \
  && rm -r kea*
  && ldconfig
```

When I run `kea-dhcp4` with the following config:
```
{
    "Dhcp4": {
            "hooks-libraries": [{
                "library": "/usr/local/lib/hooks/libdhcp_lease_cmds.so"
            }],
            "control-socket": {
                "socket-type": "unix",
                "socket-name": "/tmp/kea-dhcp4-ctrl.sock"
            },
            "lease-database": {
                ...
            },
            "expired-leases-processing": {
                ...
            },
            ...
    },
    "Logging": {
            "loggers": [
            {
                "name": "kea-dhcp4",
                "output_options": [
                { "output": "stdout" }
                ],
                "severity": "INFO",
                "debuglevel": 0
            }
            ]
        }
}
```

I get an error as follows:
```
2019-01-22 20:44:22.375 ERROR [kea-dhcp4.hooks/142] HOOKS_LOAD_FRAMEWORK_EXCEPTION 'load' function in hook library /usr/local/lib/hooks/libdhcp_lease_cmds.so threw an exception: reason attempt to access logging function before logging has been initialized
2019-01-22 20:44:22.375 ERROR [kea-dhcp4.hooks/142] HOOKS_UNLOAD_FRAMEWORK_EXCEPTION 'unload' function in hook library /usr/local/lib/hooks/libdhcp_lease_cmds.so threw an exception, reason attempt to access logging function before logging has been initialized
2019-01-22 20:44:22.375 ERROR [kea-dhcp4.dhcp4/142] DHCP4_PARSER_COMMIT_FAIL parser failed to commit changes: One or more hook libraries failed to load
2019-01-22 20:44:22.376 ERROR [kea-dhcp4.dhcp4/142] DHCP4_CONFIG_LOAD_FAIL configuration error using file: /usr/local/etc/kea/kea-dhcp4.conf, reason: One or more hook libraries failed to load
2019-01-22 20:44:22.376 ERROR [kea-dhcp4.dhcp4/142] DHCP4_INIT_FAIL failed to initialize Kea server: configuration error using file '/usr/local/etc/kea/kea-dhcp4.conf': One or more hook libraries failed to load
```

My instinct is that this is an issue with the linking but `ldconfig -p` looks as I would expect. 

Any advice or help would be appreciated.

Thanks,
Joe

_______________________________________________
Kea-users mailing list
[hidden email]
https://lists.isc.org/mailman/listinfo/kea-users