Re: [systemd-devel] Soliciting feedback for golang bindings to the systemd journal C API

2014-06-19 Thread Dan Mace
- Original Message -
> From: "Brandon Philips" 
> To: "Zbigniew Jędrzejewski-Szmek" 
> Cc: "Dan Mace" , "systemd Mailing List" 
> ,
> appinfra-l...@redhat.com
> Sent: Thursday, June 19, 2014 3:28:06 PM
> Subject: Re: [systemd-devel] Soliciting feedback for golang bindings to the 
> systemd journal C API
> 
> On Sat, Jun 14, 2014 at 8:13 AM, Zbigniew Jędrzejewski-Szmek
>  wrote:
> > I think that designing the api in steps like this will make it harder
> > to get a consistent design. The journal api is rather small, so I don't
> > think it is hard to cover most of it in the initial design. In my
> > experience, getting sd_journal_print, sd_journal_send, sd_journal_sendv
> > wrappers consistent requires some care.
> 
> I agree, I would rather do this all at once.

Agree.

> > About the proposed go api:
> >
> > I think the reader and writer apis should be totally separate.
> > Different files/modules/whatever. They don't share implementation,
> > and usually are not used together.

Agree.

> Yes, I agree. Actually, is there a reason to bind to the C
> sd_journal_print if we already have a pure Go version of
> sd_journal_send?
> https://github.com/coreos/go-systemd/blob/master/journal/send.go
> 
> > In some places in the go code '%s' is used with numerical 'err'.
> > Does this work at all?
> 
> Yes it works, Go's print is typesafe but it will look strange:
> %!s(int=42). We should probably turn them into syscall.Errno() type.

Oversights on my part.  This is rough POC code.  I agree they should be 
translated.

> > It's hard to say with the scant backtrace. But I don't recall
> > ever seeing any crashes related to sd_journal_wait.
> 
> Dan, how do you want me to help out with this? I am happy to dig in if
> you want to share a branch or something. Or you can send a PR and we
> can start from there.
> 
> Brandon
> 
> [1] http://play.golang.org/p/zTOuMj-sg7
> [2] http://play.golang.org/p/NDnJF8Zocf
> 

This is on my backburner at the moment while I work on some other things.  
Hitting the segfault while testing our primary use case and being unable to 
reproduce the error made me nervous enough that I don't feel comfortable 
promoting any of the current work yet.  I was hoping something obvious would 
jump out, or somebody else running the test from my branch would be able to 
observe the segfault and have a better ability to debug.  My branch[1] is still 
in the same state as before.  I don't think a PR makes sense quite yet until 
there's increased confidence in the stability.  Without knowing the cause, I 
can't predict the impact to the design that might come with the solution.

-- Dan

[1] https://github.com/ironcladlou/go-systemd/compare/cgo-journal
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Soliciting feedback for golang bindings to the systemd journal C API

2014-06-10 Thread Dan Mace
- Original Message -
> From: "Brandon Philips" 
> To: "Dan Mace" 
> Cc: appinfra-l...@redhat.com, systemd-devel@lists.freedesktop.org
> Sent: Tuesday, June 10, 2014 1:08:59 PM
> Subject: Re: [systemd-devel] Soliciting feedback for golang bindings to the 
> systemd journal C API
> 
> On Mon, Jun 9, 2014 at 11:56 AM, Dan Mace  wrote:
> >   http://fpaste.org/107299/14019224/
> 
> Hrm, odd. Was it with the given tests? I will try it out and see if I
> can reproduce.  I don't see anything immediately wrong in the code.
> 
> Thanks,
> 
> Brandon
> 

Brandon,

The error was observed running this test:

  
https://github.com/ironcladlou/go-systemd/blob/cgo-journal/journal/journal_test.go

The test was executed in a Fedora 20 VirtualBox VM on a Fedora 20 host.  I'm 
CC'ing Jhon Honce who is the only human who actually witnessed the panic.

Thanks for looking into it, and sorry I don't have more information!

-- Dan
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Soliciting feedback for golang bindings to the systemd journal C API

2014-06-10 Thread Dan Mace
- Original Message -
> From: "David Timothy Strauss" 
> To: "Dan Mace" 
> Cc: appinfra-l...@redhat.com, "systemd Mailing List" 
> 
> Sent: Monday, June 9, 2014 8:29:11 PM
> Subject: Re: [systemd-devel] Soliciting feedback for golang bindings to the 
> systemd journal C API
> 
> The CoreOS crew has already done most of this work by writing a native
> Go implementation (rather than wrapping the C APIs).
> 

Can you please point me to the implementation?  All I've seen is this:

  https://github.com/coreos/go-systemd/blob/master/journal/send.go

Which only handles writes via the Unix socket.  The implementation we're 
prototyping supports journal queries in ways that (to my knowledge) aren't 
possible without either forking to external tools (e.g. journalctl) or linking 
to sd-journal.

If there's already code out there which satisfies the need, I'd be happy to use 
and contribute to it.

--
Dan Mace
OpenShift, PaaS by Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Soliciting feedback for golang bindings to the systemd journal C API

2014-06-09 Thread Dan Mace
Hello!

We've been working on golang bindings to the systemd journal interface 
(sd-journal.h), as well as a higher level go API which builds on the bindings.  
The immediate goal is to replace  the use of forked calls to journalctl in a 
project.  To that end, we've been wrapping only the subset of sd-journal.h 
necessary to build the go API necessary to support existing journalctl usages.

The work is currently taking place in my fork of the go-systemd project:

  https://github.com/ironcladlou/go-systemd/compare/cgo-journal

(The only test code there is a work-in-progress scratchpad I've been using for 
iterative development- actual tests are forthcoming once we're satisfied there 
won't be any more API churn.)

We've observed a segfault during this simple test, but only once:

  http://fpaste.org/107299/14019224/

I've had no success reproducing the segfault.  My first thought was a race when 
closing the journal while dealing with the setup or execution of 
sd_journal_wait, but no amount of concurrent closing or other access to the 
sd_journal instance has led me to the same error.  Any advice for reproducing 
the segfault would be greatly appreciated.

We're interested in getting feedback on the cgo bindings and go API.  Does 
anybody else out there see a need for these bindings?  All suggestions and 
contributions are very welcome.

--
Dan Mace
OpenShift, PaaS by Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel