Skip to content

pact-avro-plugin fails to startup when pact-plugin-driver uses threads, rather than tokio tasks due to LogBack config #42

@YOU54F

Description

@YOU54F

See pact-foundation/pact-plugins#68 for background.

When the pact-plugin-driver uses System threads for managing plugins, the Logback config in the pact-avro-plugin is causing issues.

This is rather than using tokio tasks (using threads was introduced for windows due to hanging plugin tests) and I would like to introduce for macos/linux (due to segfaulting plugin tests in pact-go)

I have tried to narrow it down.

The println for the servers port & serverKey is here

The logback config is here

Removing these bits from the config ( the RollingFileAppender & AsyncAppender ) allow the pact plugin statup message to be picked up

  • <appender name="PLAIN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
    <file>logs/plugin.log</file>
    <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
    <!-- daily rollover -->
    <fileNamePattern>logs/plugin.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
    <timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP">
    <!-- or whenever the file size reaches 50MB -->
    <maxFileSize>50MB</maxFileSize>
    </timeBasedFileNamingAndTriggeringPolicy>
    <!-- keep 30 days' worth of history -->
    <maxHistory>30</maxHistory>
    </rollingPolicy>
    <encoder>
    <pattern>%d{HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%line - %message%n%xException{10}</pattern>
    </encoder>
    </appender>
    <appender name="PLAIN_ASYNCFILE" class="ch.qos.logback.classic.AsyncAppender">
    <appender-ref ref="PLAIN_FILE"/>
    <includeCallerData>true</includeCallerData>
    </appender>
  • <appender-ref ref="PLAIN_ASYNCFILE" />

Effectively this YOU54F#2

I've tried removing just the AsyncAppender to no avail, so this means that to get the avro plugin to work on Windows, we need to disable the logging to file, and if we want to fix pact-go plugin behaviour on macos/linux, we will need to switch over to using threads, which means this issue will affect all users.

cc @uglyog - maybe you can shed some light on the world of java loggers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions