Hi Timo,
   i'm not programmer at all but here is my understanding of the problem:

 In src/imap/imap-client-hibernate.c, the code serializes peer_dev_major and 
peer_dev_minor using major() and minor() macros:

 str_printfa(cmd, "\tpeer_dev_major=%lu\tpeer_dev_minor=%lu\tpeer_ino=%llu",
             (unsigned long)major(peer_st.st_dev),
             (unsigned long)minor(peer_st.st_dev),
             (unsigned long long)peer_st.st_ino);

 On FreeBSD, major() and minor() can return UINT64_MAX (18446744073709551615) 
for file descriptors that are not block/character devices (such as sockets on 
tmpfs/devfs). This value exceeds UINT_MAX and cannot be parsed by str_to_uint() 
in imap-master-client.c, causing hibernation to fail.

     On 25 Jun 2026, at 14:37, Jordan Ostrev <[email protected]> wrote:
     Hi Timo,

     I've made freebsd port patch which looks like that:

     # cat files/patch-configure.ac
     --- configure.ac.orig   2026-06-25 11:03:42 UTC
     +++ configure.ac
     @@ -363,7 +363,7 @@ AS_CASE(
     DOVECOT_IOLOOP
     DOVECOT_NOTIFY
     AS_CASE(
     -   ["$notify"],
     +   ["$have_notify"],
        [none],   [BUILD_IMAP_HIBERNATE=0],
        [kqueue], [BUILD_IMAP_HIBERNATE=0],
        [BUILD_IMAP_HIBERNATE=1])

     I'm simulating the situation with telnet:
     c idle
     + idling
     * 4228 EXPUNGE
     * 0 RECENT
     * OK Still here
     * OK Still here
     * 4228 EXISTS
     * 1 RECENT
     * 4228 EXPUNGE
     * 0 RECENT
     * 4228 EXISTS
     * 1 RECENT
     * 4228 EXPUNGE
     * 0 RECENT
     * OK Still here
     * OK Still here
     * OK Still here
     * OK Still here
     * 4228 EXISTS
     * 1 RECENT
     * 4228 EXPUNGE
     * 0 RECENT
     * OK Still here
     * OK Still here
     d idle
     c BAD Idle completed.
     + idling
     * OK Still here
     * 4228 EXISTS
     * 1 RECENT
     * 4228 EXPUNGE
     * 0 RECENT
     * OK Still here
     * 4228 EXISTS
     * 4227 FETCH (FLAGS (\Seen $NotJunk NotJunk))
     * 4228 EXPUNGE
     * OK Still here

     in the log I see following:

     Jun 25 14:21:17 classic dovecot[29292]: imap-hibernate: Error: conn
     unix:imap-hibernate (uid=125): Failed to parse client input: Invalid
     peer_dev_major value: 18446744073709551615
     Jun 25 14:21:17 classic dovecot[29292]:
     imap([email protected])<29454><CLP/EhJVqIguCt00>: Error: Couldn't
     hibernate imap client: /var/run/dovecot/imap-hibernate returned failure:
     Failed to parse client input: Invalid peer_dev_major value:
     18446744073709551615
     Jun 25 14:21:17 classic dovecot[29292]: imap-hibernate: Error: conn
     unix:imap-hibernate (uid=125): Failed to parse client input: Invalid
     peer_dev_major value: 18446744073709551615
     Jun 25 14:21:17 classic dovecot[29292]:
     imap([email protected])<30943><EJZELRJVp5QuCt00>: Error: Couldn't
     hibernate imap client: /var/run/dovecot/imap-hibernate returned failure:
     Failed to parse client input: Invalid peer_dev_major value:
     18446744073709551615
     Jun 25 14:26:03 classic dovecot[29292]: imap-hibernate: Error: conn
     unix:imap-hibernate (uid=125): Failed to parse client input: Invalid
     peer_dev_major value: 18446744073709551615
     Jun 25 14:26:03 classic dovecot[29292]:
     imap([email protected])<30943><EJZELRJVp5QuCt00>: Error: Couldn't
     hibernate imap client: /var/run/dovecot/imap-hibernate returned failure:
     Failed to parse client input: Invalid peer_dev_major value:
     18446744073709551615
     Jun 25 14:26:03 classic dovecot[29292]: imap-hibernate: Error: conn
     unix:imap-hibernate (uid=125): Failed to parse client input: Invalid
     peer_dev_major value: 18446744073709551615
     Jun 25 14:26:03 classic dovecot[29292]:
     imap([email protected])<29454><CLP/EhJVqIguCt00>: Error: Couldn't
     hibernate imap client: /var/run/dovecot/imap-hibernate returned failure:
     Failed to parse client input: Invalid peer_dev_major value:
     18446744073709551615
     Jun 25 14:29:28 classic dovecot[29292]: imap-hibernate: Error: conn
     unix:imap-hibernate (uid=125): Failed to parse client input: Invalid
     peer_dev_major value: 18446744073709551615
     Jun 25 14:29:28 classic dovecot[29292]:
     imap([email protected])<29454><CLP/EhJVqIguCt00>: Error: Couldn't
     hibernate imap client: /var/run/dovecot/imap-hibernate returned failure:
     Failed to parse client input: Invalid peer_dev_major value:
     18446744073709551615
     Jun 25 14:33:36 classic dovecot[29292]: imap-hibernate: Error: conn
     unix:imap-hibernate (uid=125): Failed to parse client input: Invalid
     peer_dev_major value: 18446744073709551615
     Jun 25 14:33:36 classic dovecot[29292]:
     imap([email protected])<33114><cX5QWRJVrZguCt00>: Error: Couldn't
     hibernate imap client: /var/run/dovecot/imap-hibernate returned failure:
     Failed to parse client input: Invalid peer_dev_major value:
     18446744073709551615
     Jun 25 14:33:37 classic dovecot[29292]: imap-hibernate: Error: conn
     unix:imap-hibernate (uid=125): Failed to parse client input: Invalid
     peer_dev_major value: 18446744073709551615
     Jun 25 14:33:37 classic dovecot[29292]:
     imap([email protected])<33112><NlVOWRJVkbEuCt00>: Error: Couldn't
     hibernate imap client: /var/run/dovecot/imap-hibernate returned failure:
     Failed to parse client input: Invalid peer_dev_major value:
     18446744073709551615
     Jun 25 14:34:40 classic dovecot[29292]: imap-hibernate: Error: conn
     unix:imap-hibernate (uid=125): Failed to parse client input: Invalid
     peer_dev_major value: 18446744073709551615
     Jun 25 14:34:40 classic dovecot[29292]:
     imap([email protected])<33112><NlVOWRJVkbEuCt00>: Error: Couldn't
     hibernate imap client: /var/run/dovecot/imap-hibernate returned failure:
     Failed to parse client input: Invalid peer_dev_major value:
     18446744073709551615

     Here is my piece of my config:
     # dovecot -a | grep hibernate
     imap_hibernate_timeout = 1 mins
     service imap-hibernate {
      unix_listener imap-hibernate {

     What we can do more?

     KR,
     Jordan

       On 25 Jun 2026, at 12:34, Timo Sirainen <[email protected]> wrote:

       On 24. Jun 2026, at 21.34, Jordan Ostrev via dovecot
       <[email protected]> wrote:

         Hi,
         IMAP hibernation compiles and attempts to run on FreeBSD 15.x
         (tested with
         Dovecot 2.4.4 and FreeBSD 15.1), but fails at runtime with:
         plain

         imap-hibernate: Error: conn unix:imap-hibernate (uid=125): Failed to
         parse client input: Invalid peer_dev_major value:
         18446744073709551615

         Jun 24 21:27:08 classic dovecot[36888]: imap-hibernate: Error: conn
         unix:imap-hibernate (uid=125): Failed to parse client input: Invalid
         peer_dev_major value: 18446744073709551615
         Jun 24 21:27:08 classic dovecot[36888]:
         imap([email protected])<37120><ExaV/gNVAdt/AAAB>: Error: Couldn't
         hibernate imap client: /var/run/dovecot/imap-hibernate returned
         failure: Failed to parse client input: Invalid peer_dev_major value:
         18446744073709551615

       ..

          1. Disable hibernation at compile time for kqueue systems, or

       It was already supposed to be done, but looks like there's a bug. Can
       you verify if this works? :

       diff --git a/configure.ac b/configure.ac
       index 9beacaa299..04f9c8edd6 100644
       --- a/configure.ac
       +++ b/configure.ac
       @@ -363,7 +363,7 @@ DOVECOT_TYPEOF
       DOVECOT_IOLOOP
       DOVECOT_NOTIFY
       AS_CASE(
       -   ["$notify"],
       +   ["$have_notify"],
         [none],   [BUILD_IMAP_HIBERNATE=0],
         [kqueue], [BUILD_IMAP_HIBERNATE=0],
         [BUILD_IMAP_HIBERNATE=1])
_______________________________________________
dovecot mailing list -- [email protected]
To unsubscribe send an email to [email protected]

Reply via email to