Skip to content

static initializers of StartupMessage cause blocking calls #275

@62mkv

Description

@62mkv

Bug Report

Versions

  • Driver: 0.8.0.RELEASE
  • Database: 11.7
  • Java: 8.0.172
  • OS: Windows 10

Current Behavior

Initialization blocks of static variables in StartupMessage might issue blocking calls, which might lead to BlockHound enabled tests failing, as in:

Caused by: reactor.blockhound.BlockingOperationError: Blocking call! java.io.FileInputStream#readBytes
    at java.io.FileInputStream.readBytes(FileInputStream.java)
    at java.io.FileInputStream.read(FileInputStream.java:255)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:246)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:265)
    at java.io.DataInputStream.readByte(DataInputStream.java:265)
    at java.time.zone.TzdbZoneRulesProvider.load(TzdbZoneRulesProvider.java:162)
    at java.time.zone.TzdbZoneRulesProvider.<init>(TzdbZoneRulesProvider.java:113)
    at java.time.zone.ZoneRulesProvider$1.run(ZoneRulesProvider.java:157)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.time.zone.ZoneRulesProvider.<clinit>(ZoneRulesProvider.java:144)
    at java.time.ZoneRegion.ofId(ZoneRegion.java:120)
    at java.time.ZoneId.of(ZoneId.java:411)
    at java.time.ZoneId.of(ZoneId.java:359)
    at java.time.ZoneId.of(ZoneId.java:315)
    at java.util.TimeZone.toZoneId(TimeZone.java:556)
    at java.time.ZoneId.systemDefault(ZoneId.java:274)
    at io.r2dbc.postgresql.message.frontend.StartupMessage.<clinit>(StartupMessage.java:58)

Steps to reproduce

any code, that will execute r2dbc-postgresql query, wrapped with BlockHound.install()

Expected behavior/code

No BlockHound-caused exceptions

Possible Solution

As has been suggested by @mp911de :

Interestingly, switching to TimeZone.getDefault().getID() returns the same result but without loading the timezone database.

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions