Coder Social home page Coder Social logo

capnp-ruby's Introduction

Hi there 👋

I'm Charles Strahan, a software engineer based out of Dallas, TX.

Some areas of interest:

  • Developer tools/enablement
  • Programming language analysis/implementation
  • Distributed systems

Links

My GitHub stats:

Profile Summary Card

GitHub stats

Top Langs

capnp-ruby's People

Contributors

cstrahan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

capnp-ruby's Issues

Unhandled exceptions causing Ruby aborts

It seems important for the extension to catch and wrap any C++ exceptions so that they don't abort the interpreter. The first one I noticed was passing an empty string to make_from_bytes:

require "capn_proto"

File.open("t.capnp", "w"){|f| f.write(DATA.read)}

module T
  extend CapnProto::SchemaLoader
  load_schema "t.capnp"
end

begin
  T::Message.make_from_bytes("")
rescue Exception => e
  puts "Never gonna get you here..."
end


__END__
@0xcc1a7e7464ae3256;

struct Message {
  type @0 :Int8;
}

Producing:

libc++abi.dylib: terminating with uncaught exception of type kj::ExceptionImpl: src/capnp/message.c++:57: requirement not met: expected segment != nullptr && segment->containsInterval(segment->getStartPtr(), segment->getStartPtr() + 1); Message did not contain a root pointer.
stack: 0x1068a3c92 0x1068a73cd 0x1068457e6 0x106844462 0x10677c69b 0x10677c552 0x106521ebb 0x1065217f4 0x10650aac3 0x1065185a1 0x106519428 0x1063e26a4 0x1063e25ce 0x10639d01f 0x7fff8a2625fd
Abort trap: 6

There are others:

require "capn_proto"

File.open("t.capnp", "w"){|f| f.write(DATA.read)}

module T
  extend CapnProto::SchemaLoader
  load_schema "t.capnp"
end

__END__
@0x0;

struct Message {
  type @0 :Int8;
}
libc++abi.dylib: terminating with uncaught exception of type kj::ExceptionImpl: t.capnp:0: bug in code: Invalid ID.  Please generate a new one with 'capnpc -i'.
stack: 0x100b01dcf 0x100a2a19d 0x100a2a41c 0x100a07401 0x1009fdf30 0x100a0ca09 0x1009fc76d 0x1009fbbe1 0x100a2a6b7 0x100a22a3a 0x100a25149 0x100a23ef4 0x100a243bb 0x100a2803c 0x100a27fa0 0x1009dbd1d
Abort trap: 6

Even a generic exception would be preferable to aborting the interpreter; so long as there's the possibility of an interpreter abort the library's unusable in production code.

Of course, the library itself could handle more cases before passing off to C++, but I'm less concerned about that. Right now I have a unit test that aborts half-way through; a generically wrapped error would be much preferable since all my tests would still run.

License missing from gemspec

RubyGems.org doesn't report a license for your gem. This is because it is not specified in the gemspec of your last release.

via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

Including a license in your gemspec is an easy way for rubygems.org and other tools to check how your gem is licensed. As you can imagine, scanning your repository for a LICENSE file or parsing the README, and then attempting to identify the license or licenses is much more difficult and more error prone. So, even for projects that already specify a license, including a license in your gemspec is a good practice. See, for example, how rubygems.org uses the gemspec to display the rails gem license.

There is even a License Finder gem to help companies/individuals ensure all gems they use meet their licensing needs. This tool depends on license information being available in the gemspec. This is an important enough issue that even Bundler now generates gems with a default 'MIT' license.

I hope you'll consider specifying a license in your gemspec. If not, please just close the issue with a nice message. In either case, I'll follow up. Thanks for your time!

Appendix:

If you need help choosing a license (sorry, I haven't checked your readme or looked for a license file), GitHub has created a license picker tool. Code without a license specified defaults to 'All rights reserved'-- denying others all rights to use of the code.
Here's a list of the license names I've found and their frequencies

p.s. In case you're wondering how I found you and why I made this issue, it's because I'm collecting stats on gems (I was originally looking for download data) and decided to collect license metadata,too, and make issues for gemspecs not specifying a license as a public service :). See the previous link or my blog post about this project for more information.

Still working on this? (Also: contact info)

I'd love to have a mature Cap'n Proto binding for Ruby! Particularly one that works across CRuby and JRuby.

I was just talking to @kentonv about it, and this approach (MRI cext) seems reasonable for CRuby. I think the JRuby version should bind to capnproto-java, which is unfortunately much less mature than the C++ version and, AFAIK, doesn't support the RPC protocol.

Getting serialization working across both CRuby and JRuby would be a good start.

Have you thought about making a project mailing list?

Doesn't build on Debian unstable

I've tried to build it with both the installed package and by installing from source (after removing the deb package) but it fails with the same error:

Given that gem install failed I tried doing it manually:

# cd /usr/local/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/capn_proto-0.0.1.alpha.5/ext/capn_proto
# make distclean

# ruby extconf.rb setup
creating Makefile

# make
compiling class_builder.cc
In file included from class_builder.cc:1:0:
ruby_capn_proto.h:17:26: fatal error: capnp/object.h: No such file or directory
#include <capnp/object.h>
                          ^
compilation terminated.
make: *** [class_builder.o] Error 1

I looked to see if there was an object.h anywhere in capnproto but I couldn't see one. So I tried commenting out the #include <capnp/object.h> line but that didn't get me very far. No surprise there really!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.