public inbox for cygwin-developers@cygwin.com
 help / color / mirror / Atom feed
From: Jon Turney <jon.turney@dronecode.org.uk>
To: cygwin-developers@cygwin.com
Subject: Re: glib2.0 2.64.6-1 (TEST)
Date: Fri, 28 Jul 2023 16:17:03 +0100	[thread overview]
Message-ID: <c3573bda-a69f-0788-801f-8bb87eac25f7@dronecode.org.uk> (raw)
In-Reply-To: <ZMEuw8xJhnRhhSos@calimero.vinschen.de>

[-- Attachment #1: Type: text/plain, Size: 1456 bytes --]

On 26/07/2023 15:33, Corinna Vinschen wrote:
> On Jul  3 15:49, Jon Turney wrote:
>> On 02/07/2023 15:30, Jon Turney wrote:
>>>
>>> There are many test-suite failures, however, as far as I can tell, they
>>> are not regressions, so this should work as well as it ever did.
>>
>> At least some of these test failures are due to bugs or shortcomings in the
>> Cygwin DLL. In an ideal world, I'd have the time and motivation to
>> investigate them all, but here's a brief summary of the few I looked into
>> ...
> 
>> stream_rw-all: writes to a pipe until it's full, then ends up blocking when
>> poll() still indicates it's writeable?
> 
> Pipes never worked 100% POSIX-like, unfortunately, but the hang
> was supposed to be fixed by introducingh the semaphore select_sem.
> 
> Do you have an STC?  Takashi, can you take a look?

So, I messed up: it's a socketpair, not a pipe.  And I typoed the test 
name, it's actually stream-rw_all

If I'm remembering correctly, it ends up getting stuck at:

https://gitlab.gnome.org/GNOME/glib/-/blob/main/gio/tests/stream-rw_all.c#L179

I think this boils down to just:

- create a socketpair
- while polling if socket is writeable, write 100 zeroes to socket

This should stop when socket is not writeable, but actually just seems 
to block in the write.

Attached is an attempt at that, stripping out the glib stuff, which does 
indeed gets stuck. But maybe I messed up, the expectations of the test 
aren't good...

[-- Attachment #2: socketpair_full.c --]
[-- Type: text/plain, Size: 807 bytes --]

#include <assert.h>
#include <poll.h>
#include <stdio.h>
#include <sys/socket.h>
#include <unistd.h>

int main()
{
  char wbuf[100] = { 0, };
  int out;

  {
    int sv[2];
    int s;

    s = socketpair (AF_UNIX, SOCK_STREAM, 0, sv);
    assert (s == 0);

    out = sv[0];
  }

  size_t in_flight = 0;
  while (1)
    {
      struct pollfd fds[1];
      fds[0].fd = out;
      fds[0].events = POLLOUT;

      int r = poll(fds, 1, 0);
      assert(r >= 0);

      // fd is not ready to write
      if (!(fds[0].revents & POLLOUT))
        break;

      // otherwise, fd is ready to write, implies some data may be written without blocking
      ssize_t s = write (out, wbuf, sizeof wbuf);
      assert (s > 0);
      in_flight += s;
      printf("%zd written, total in_flight %zd\n", s, in_flight);
    }
}

  parent reply	other threads:[~2023-07-28 15:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <adaf0c49-3ab2-c883-474e-f9e00f79c5bb@dronecode.org.uk>
2023-07-03 14:49 ` Jon Turney
2023-07-26 14:33   ` Corinna Vinschen
2023-07-26 15:56     ` Jon Turney
2023-07-28 15:17     ` Jon Turney [this message]
2023-08-04 17:04     ` Jon Turney
2023-08-07  9:51       ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=c3573bda-a69f-0788-801f-8bb87eac25f7@dronecode.org.uk \
    --to=jon.turney@dronecode.org.uk \
    --cc=cygwin-developers@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).