<div dir="ltr"><div class="gmail_quote"><p class="MsoNormal" style="margin:0cm 0cm 6pt;color:rgb(80,0,80);line-height:14.6667px;font-size:10pt;font-family:Arial,sans-serif"><span lang="EN-US" style="font-family:"Segoe UI",sans-serif;color:rgb(36,41,46);background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)">></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)"> </span></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)">></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)"> </span><span style="color:rgb(36,41,46);font-family:"Segoe UI",sans-serif;font-size:10pt">I have the following issue:</span></p><p class="MsoNormal" style="margin:0cm 0cm 6pt;color:rgb(80,0,80);line-height:14.6667px;font-size:10pt;font-family:Arial,sans-serif"><span lang="EN-US" style="font-family:"Segoe UI",sans-serif;color:rgb(36,41,46);background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)">></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)"> </span></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)">></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)"> </span><span style="color:rgb(36,41,46);font-family:"Segoe UI",sans-serif;font-size:10pt">An application does not receive dbus signals on its dbus file descriptor *while waiting* for a</span></p><p class="MsoNormal" style="margin:0cm 0cm 6pt;color:rgb(80,0,80);line-height:14.6667px;font-size:10pt;font-family:Arial,sans-serif"><span lang="EN-US" style="font-family:"Segoe UI",sans-serif;color:rgb(36,41,46);background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)">></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)"> </span></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)">></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)"> </span><span style="color:rgb(36,41,46);font-family:"Segoe UI",sans-serif;font-size:10pt">dbus-method response. Considered time frame: between sending the method-call and receiving</span></p><p class="MsoNormal" style="margin:0cm 0cm 6pt;color:rgb(80,0,80);line-height:14.6667px;font-size:10pt;font-family:Arial,sans-serif"><span lang="EN-US" style="font-family:"Segoe UI",sans-serif;color:rgb(36,41,46);background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)">></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)"> </span></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)">></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)"> </span><span style="color:rgb(36,41,46);font-family:"Segoe UI",sans-serif;font-size:10pt">its response. After the response is being received, the (indefinitely) queued signal is not delivered</span></p><p class="MsoNormal" style="margin:0cm 0cm 6pt;color:rgb(80,0,80);line-height:14.6667px;font-size:10pt;font-family:Arial,sans-serif"><span lang="EN-US" style="font-family:"Segoe UI",sans-serif;color:rgb(36,41,46);background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)">></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)"> </span></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)">></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)"> </span><span style="color:rgb(36,41,46);font-family:"Segoe UI",sans-serif;font-size:10pt">until another signal / method call triggers the sdbus file descriptor (which is supervised by</span></p><p class="MsoNormal" style="margin:0cm 0cm 6pt;color:rgb(80,0,80);line-height:14.6667px;font-size:10pt;font-family:Arial,sans-serif"><span lang="EN-US" style="font-family:"Segoe UI",sans-serif;color:rgb(36,41,46);background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial"><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)">></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)"> </span></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)">></span><span style="font-family:Arial,Helvetica,sans-serif;font-size:small;color:rgb(34,34,34)"> </span><span style="color:rgb(36,41,46);font-family:"Segoe UI",sans-serif;font-size:10pt">select()/epoll()).</span></p></div><div class="gmail_quote"><br></div><div class="gmail_quote">> Don't use select() anymore. It's inefficient and can't handle fds ><br></div><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left:1px solid rgb(204,204,204);border-right:1px solid rgb(204,204,204);padding-left:1ex;padding-right:1ex"></blockquote>> 1024. Use poll() or epoll(). (I'll prep a patch now that removes any<br><blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left:1px solid rgb(204,204,204);border-right:1px solid rgb(204,204,204);padding-left:1ex;padding-right:1ex"></blockquote>> mention of select() from our man pages, as we shouldn't mislead users<br><blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left:1px solid rgb(204,204,204);border-right:1px solid rgb(204,204,204);padding-left:1ex;padding-right:1ex"></blockquote>> to ever use it.)<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
</blockquote><br><blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left:1px solid rgb(204,204,204);border-right:1px solid rgb(204,204,204);padding-left:1ex;padding-right:1ex"></blockquote>> Morever, when waiting on a bus object you need to use the fd returned<br><blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left:1px solid rgb(204,204,204);border-right:1px solid rgb(204,204,204);padding-left:1ex;padding-right:1ex"></blockquote>> by sd_bus_get_fd() and wait for the events returned by</div><div class="gmail_quote">> sd_bus_get_events() (which are POLLIN/POLLOUT/… events). Yes this<br><blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left:1px solid rgb(204,204,204);border-right:1px solid rgb(204,204,204);padding-left:1ex;padding-right:1ex"></blockquote>> could benefit from documentation. The timeout passed to poll() should<br><blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left:1px solid rgb(204,204,204);border-right:1px solid rgb(204,204,204);padding-left:1ex;padding-right:1ex"></blockquote>> be the one returned by sd_bus_get_timeout() or shorter.<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
</blockquote><br><blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left:1px solid rgb(204,204,204);border-right:1px solid rgb(204,204,204);padding-left:1ex;padding-right:1ex"></blockquote>> Whenever poll() reports anything call sd_bus_process(), which will do<br><blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left:1px solid rgb(204,204,204);border-right:1px solid rgb(204,204,204);padding-left:1ex;padding-right:1ex"></blockquote>> the work.<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
</blockquote><br><blockquote class="gmail_quote" style="margin:0px 0.8ex;border-left:1px solid rgb(204,204,204);border-right:1px solid rgb(204,204,204);padding-left:1ex;padding-right:1ex"></blockquote>> Lennart<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
</blockquote>
</div><div class="gmail_quote"><br></div><div class="gmail_quote">Hey Lennart - thank you for the quick response!</div><div class="gmail_quote">Ok, originally I stripped it down to select() for better comprehension.</div><div class="gmail_quote">Swichting back to epoll + making use of sd_bus_get_events() did not help</div><div class="gmail_quote">receiving the signals in this very situation. The basic communication between</div><div class="gmail_quote">sender and receiver works fine so far though. I did already make use of</div><div class="gmail_quote">sd_bus_get_fd() and sd_bus_process() - please see the referenced +</div><div class="gmail_quote">updated example project:</div><div class="gmail_quote"><a href="https://github.com/mue-jan/dbus-missing-signals-or-fd-issue" style="font-family:Arial,sans-serif;font-size:11pt;color:rgb(0,157,236)" target="_blank">https://github.com/mue-jan/dbus-missing-signals-or-fd-issue</a></div><div class="gmail_quote"><br></div><div class="gmail_quote">By the way: sd_bus_get_events() returns "0" in the referenced code-example.</div><div class="gmail_quote">The function-result printing is located right before the while(1) loop around</div><div class="gmail_quote">epoll.</div><div class="gmail_quote"><br></div><div class="gmail_quote">Jan</div></div>