Re: [capnproto] Protocol "disembargo" message

2022-12-26 Thread Jens Alfke
> On Dec 26, 2022, at 3:28 PM, Kenton Varda wrote: > > I'm not sure what you mean about "(negative) remote capability #". There are > no negative numbers. Oops, I got that from the old E documentation (erights.org.) They used negative numbers to identify capability IDs that were created

Re: [capnproto] Protocol "disembargo" message

2022-12-26 Thread Jens Alfke
> On Dec 17, 2022, at 1:46 PM, Kenton Varda wrote: > > To clarify, when I say "Carol lives in Vat A, i.e. next to Alice", I am > saying that Alice and Carol are two objects living in the same process. So a > capability pointing to Carol was passed across the network and then back > again,

[capnproto] Protocol "disembargo" message

2022-12-17 Thread Jens Alfke
As I peruse the RPC spec (rpc.capnp), I’m following along pretty well until I hit the ‘disembargo’ message (which my spellchecker keeps changing into ‘disembark’, but that’s another matter.) At this point I’m only interested in Level 1 functionality, two peers, which AFAIK is as far as the

[capnproto] RPC protocol framing details?

2022-12-16 Thread Jens Alfke
The RPC docs say: > The Cap'n Proto RPC protocol is defined in terms of Cap'n Proto serialization > schemas. The documentation is inline. See rpc.capnp. That interface definition is beautifully commented, it’s practically Literate Programming, but it’s not the whole story. How are the messages

Re: [capnproto] Server process stops accepting connections

2022-11-09 Thread Jens Alfke
> On Nov 9, 2022, at 6:47 AM, 'Kenton Varda' via Cap'n Proto > wrote: > > Have you tested whether your server is able to accept concurrent connections > normally? E.g. if you open a connection with telnet or something without > sending any bytes, leave that open, and then try to use your

[capnproto] Server process stops accepting connections

2022-11-08 Thread Jens Alfke
I’ve got a CapnP-based server program running on a Raspberry Pi 4. It’s written in C++, using CapnP 0.9.1. It’s single-threaded; the main() function just sets up a listener, calls kj::NEVER_DONE.wait, and stays there. It works fine, except that every few weeks it stops accepting connections; it

Re: [capnproto] Text blob too big.

2022-10-31 Thread Jens Alfke
> On Oct 31, 2022, at 12:21 PM, Josemi wrote: > > Hello. > > I need to work with a structured data that have atributes with undefined > lenght, some of them could have GB. Most structured storage is optimized for smaller data. And huge values in-line push all the records far apart, which

Re: [capnproto] [Request] Error fix consult

2022-09-18 Thread Jens Alfke
The error portion of that lengthy log is: [ TEST ] kj/async-test.c++:740: legacy test: Async/LargeTaskSetDestruction *** Received signal #10: Bus error: 10

Re: [capnproto] Promise destructed while it’s being processed

2022-09-04 Thread Jens Alfke
> On Sep 4, 2022, at 1:08 PM, 'Kenton Varda' via Cap'n Proto > wrote: > > - You say you can't put the promise in a TaskSet because you need to be able > to specifically cancel it. Could you instead use a kj::Canceler to control > cancellation? The canceler only wraps the promise, then you

[capnproto] Promise destructed while it’s being processed

2022-09-04 Thread Jens Alfke
I’m having some trouble with a Promise stored in a member variable, where the ’then’ block attached to the promise calls code that ends up clearing that variable. This then triggers a kj exception that a Promise is being destructed while it’s being processed. I understand why this is an error,

Re: [capnproto] Xcode hits SIGUSR1 signal when I use an Executor

2022-08-31 Thread Jens Alfke
> On Aug 30, 2022, at 7:37 PM, 'Kenton Varda' via Cap'n Proto > wrote: > > Hi Jens, > > It sounds very obnoxious that your debugger insists on breaking on this > signal. I’ve filed a bug report with Apple. > With that said, you could try compiling with `-DKJ_USE_PIPE_FOR_WAKEUP`, >

Re: [capnproto] Xcode hits SIGUSR1 signal when I use an Executor

2022-08-30 Thread Jens Alfke
TL;DR: Can the two streams created by kj::newTwoWayPipe() be used on different threads? It kind of appears not. I’ve found a workaround, the LLDB command process handle --stop false SIGUSR1 Unfortunately adding it to my .lldbrc file does nothing; I have to enter it by hand every time I

[capnproto] Xcode hits SIGUSR1 signal when I use an Executor

2022-08-30 Thread Jens Alfke
I have Cap’nProto RPC (in C++, on macOS) working well on the main thread, but I want to move it to a background thread for various reasons. However, my process is now raising SIGUSR1 signals, which the debugger breaks at, preventing the code from working. I’m following the directions in the

Re: [capnproto] Installtion Error for capnp on unix

2022-08-03 Thread Jens Alfke
(Also, if I may jump in with a pet peeve of mine: it’s better to post logs as text than as screenshots. Screenshots are not searchable, not accessible, don’t show more than a few dozen lines, and are of course much bigger. Attach the entire output as a text file, or at least just copy-and-paste

Re: [capnproto] Warnings "EventLoop destroyed with events still in the queue. Memory leak?"

2022-06-07 Thread Jens Alfke
> On Jun 7, 2022, at 3:07 PM, Kenton Varda wrote: > > Info-level logs are generally meant to be enabled only for debugging, so the > idea here is you normally shouldn't see this log. But I am debugging :) I’m debugging my code, using KJ logging. So I do see this somewhat scary-looking

Re: [capnproto] Warnings "EventLoop destroyed with events still in the queue. Memory leak?"

2022-06-07 Thread Jens Alfke
> On Jun 7, 2022, at 9:53 AM, 'Kenton Varda' via Cap'n Proto > wrote: > > Ideally, you should set things up so that when the stack unwinds, all Promise > objects are destroyed before the EventLoop is destroyed. Thanks! I actually figured this out shortly after posting, but forgot to send a

[capnproto] Warnings "EventLoop destroyed with events still in the queue. Memory leak?"

2022-05-23 Thread Jens Alfke
I’m in the midst of improving the error handling in my code, but there’s a warning logged by KJ that I can’t figure out. I’d appreciate any advice or insight. It happens when my client code fails to connect because server-side auth fails, so it gets an abrupt "Connection reset by peer” error

Re: [capnproto] Building with CMake

2022-05-14 Thread Jens Alfke
> On May 13, 2022, at 6:07 PM, Kenton Varda wrote: > > Do you mean that iOS was broken at the last release, but has been fixed at > master since then? (I don't know how to test iOS so I have no idea which > versions work or not…) I just mean that AFAIK there are no binary libraries for iOS

[capnproto] Building with CMake

2022-05-13 Thread Jens Alfke
I want to build Cap’n Proto from source as part of my project; I know it’s preferred to download a release, but I need to support iOS and there are no releases for that AFAIK. The build instructions at https://capnproto.org/install.html seem out of date;

[capnproto] Build error on Raspbian, "undefined reference to `__atomic_load_8'"

2022-04-08 Thread Jens Alfke
I'm building CapnP 0.9.1 from source on a new Raspberry Pi 4 running Raspbian (because apt only has version 0.7.) curl -O https://capnproto.org/capnproto-c++-0.9.1.tar.gz tar zxf capnproto-c++-0.9.1.tar.gz cd capnproto-c++-0.9.1 ./configure make -j6 check sudo make install Everything went fine

[capnproto] Having trouble with Github CI

2022-02-26 Thread Jens Alfke
I’m trying to get my (C++) project to build in Github Actions, but getting compile errors because apparently there’s a version mismatch between the Cap’n Proto headers and tool. I don’t build Cap’n Proto as part of the project; instead I use a package manager to install it. My CMakeLists.txt

[capnproto] Writing tests for RPC-based code?

2022-02-21 Thread Jens Alfke
Does anyone have advice on writing C++ automated tests for RPC-based code? (FWIW, I use the Catch2 unit-test framework, but I don’t restrict it to true ‘unit’ tests.) Say I’ve got an interface file, a class `Client` built atop classes generated from that interface, and a class `Server` that

Re: [capnproto] Implementing SecretHandshake secure-connection support in C++

2022-01-13 Thread Jens Alfke
> On Jan 13, 2022, at 9:31 AM, Kenton Varda wrote: > > It looks like the chacha20 functions have variants with an "ic" parameter, > which lets you specify the block counter, but the salsa20 functions don't > have this for some reason. A block counter would still require dividing the stream

Re: [capnproto] Implementing SecretHandshake secure-connection support in C++

2022-01-12 Thread Jens Alfke
>> Hmm if you're using a plain xsalsa20 stream and not secret boxes, does that >> mean you're implementing only encryption, not authentication? Note that >> XSalsa20 and related ciphers work by generating a random stream, and then >> XORing it with the plaintext. FYI: It turns out that my

[capnproto] Noob question: Can an interface method return null?

2022-01-12 Thread Jens Alfke
This seems like a dumb question, but I’ve been unable to find an answer. Does the RPC system support null values? In particular, if an RPC method returns an interface, is it able to return null? Say Widget is an interface, and in another interface I’ve got a method widgetNamed @1 (name:

Re: [capnproto] Implementing SecretHandshake secure-connection support in C++

2022-01-12 Thread Jens Alfke
> On Jan 12, 2022, at 9:22 AM, Kenton Varda wrote: > > Sorry for the long delay in replying, I had a baby the day you sent this! Congratulations!  I remember those days... > This is neat! How many round trips are needed to set up a connection? There are four messages: C->S, S->C, C->S,

[capnproto] How can a server method get info about the client connection?

2021-12-16 Thread Jens Alfke
Now that I've implemented authenticated connections, *I need my server-side methods to be able to find out the identity (public key) of the connected peer*. So for example, my method LibraryImpl::checkoutBook(isbn) needs to check the identity of the client (as given in the SecretHandshake when

Re: [capnproto] Implementing SecretHandshake secure-connection support in C++

2021-12-14 Thread Jens Alfke
After some more work and cleanup, I’ve published my source code at https://github.com/snej/secret-handshake-capnp Suggestions and fixes gratefully accepted, especially since much of the code is taken from Cap’n Proto itself and was

Re: [capnproto] Implementing SecretHandshake secure-connection support in C++

2021-12-11 Thread Jens Alfke
I just got it working! Once I got the code finished and compiling, there were just a few runtime issues before it succeeded. The protocol is pretty simple — each side sends a challenge, receives the other’s challenge, then sends a

[capnproto] Implementing SecretHandshake secure-connection support in C++

2021-12-09 Thread Jens Alfke
I'm starting to implement support for SecretHandshake , a "secure-channel based on a a mutually authenticating key agreement handshake, with forward secure identity metadata". shs1-c implements

Re: [capnproto] Unsubscribe in pub/sub model

2021-12-02 Thread Jens Alfke
I'm also implementing pub-sub, so I was glad to see this thread before I wasted too much time. I'm implementing this pattern, but having trouble on the client side. In terms of the example interface, I've created my SubscriberImpl class, and written the code to send the "subscribe" message.

[capnproto] Can't put C++ Client object in std::map

2021-12-01 Thread Jens Alfke
Hi! I'm getting started with capnp, using C++ bindings (with C++17 compiled by Clang 12.) I'm having trouble storing remote object references, i.e. xx::Client objects, in STL collections. For example: std::map foobars; ... Foobar::Client c = promise.wait(waitScope).getFoobar();