Giter VIP home page Giter VIP logo

libfluent's People

Contributors

m-mizutani avatar termoshtt 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

Watchers

 avatar  avatar  avatar  avatar  avatar

libfluent's Issues

Test enhancement with Python

Background

Several current tests are unstable because they need interactions with an other process that is not enough controlled. Then, sometimes tests fail and it's difficult to fix.

Approach

Create a program with libfluent that is different test program ( bin/fluent-test ) and it will be managed by a Python script.

Message::Array cause memory leaks

$ git diff
diff --git a/src/fluent/message.hpp b/src/fluent/message.hpp
index a71c6a3..a184c5d 100644
--- a/src/fluent/message.hpp
+++ b/src/fluent/message.hpp
@@ -149,7 +149,7 @@ namespace fluent {
       std::vector<Object*> array_;
     public:
       Array() {}
-      ~Array() {}
+      ~Array();
       Map *retain_map();
       Array *retain_array();
       void push(const std::string &val);
diff --git a/src/message.cc b/src/message.cc
index 4d1b705..c3e04d8 100644
--- a/src/message.cc
+++ b/src/message.cc
@@ -265,6 +265,12 @@ namespace fluent {
     return map;
   }

+  Message::Array::~Array() {
+    for (auto it = this->array_.begin(); it != this->array_.end(); it++) {
+      delete *it;
+    }
+  }
+
   void Message::Array::push(const std::string &val) {
     Object *v = new String(val);
     this->array_.push_back(v);

cmake add_subdirectory

I'm trying to use libfluent in our own project. Lines 51 and 59 of your CMakeLists.txt cause issues with this.
We are including msgpack-c and libfluent using add_subdirectory calls. We have no desire to build libfluent separately and install.

Line 51 causes:
CMake Error: install(EXPORT "fluentConfig" ...) includes target "fluent-shared" which requires target "msgpackc" that is not in the export set.

If line 51 is commented out, line 59 causes:
CMake Error: INSTALL(EXPORT) given unknown export "fluentConfig"

If I comment both of them out then everything works quite well.
I'm not familiar enough with cmake to know a proper workaround for this, but as we intend to use this library as a submodule and contribute any changes upstream if we have any, I'd like to not have to maintain a custom version.

Do you have any input regarding my issue?

Fix warnings: "warning: 'rc' may be used uninitialized in this function" and "warning: comparison between signed and unsigned integer expressions"

While compling libfluent with different compiler settings I got two warnings.

`

13-Feb-2018 15:42:09 /data/Libraries/libfluent/src/emitter.cc: In member function 'virtual void fluent::FileEmitter::worker()':
13-Feb-2018 15:42:09 /data/Libraries/libfluent/src/emitter.cc:234:9: warning: 'rc' may be used uninitialized in this function [-Wmaybe-uninitialized]
`

`

13-Feb-2018 15:42:16 /data/Libraries/libfluent/tools/fluent-bench.cc: In function 'int main(int, char**)':
13-Feb-2018 15:42:16 /data/Libraries/libfluent/tools/fluent-bench.cc:68:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
13-Feb-2018 15:42:16 int diff = (mps > msg_count) ? mps - msg_count : msg_count - mps;
13-Feb-2018 15:42:16 ^
13-Feb-2018 15:42:16 /data/Libraries/libfluent/tools/fluent-bench.cc:75:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
13-Feb-2018 15:42:16 if (mps < msg_count) {
13-Feb-2018 15:42:16 ^
13-Feb-2018 15:42:16 /data/Libraries/libfluent/tools/fluent-bench.cc:77:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
13-Feb-2018 15:42:16 } else if (mps > msg_count) {
`
The following changes fixes the issues.
diff --git a/Libraries/libfluent/src/emitter.cc b/Libraries/libfluent/src/emitter.cc
index 28fb5fb..e533b81 100644
--- a/Libraries/libfluent/src/emitter.cc
+++ b/Libraries/libfluent/src/emitter.cc
@@ -212,7 +212,7 @@ namespace fluent {
     Message *root;
     while (nullptr != (root = this->queue_.bulk_pop())) {
       for(Message *msg = root; msg; msg = msg->next()) {
-        int rc;
+        int rc = 0;
         switch(this->format_) {
           case MsgPack: {
             msgpack::sbuffer buf;


diff --git a/Libraries/libfluent/tools/fluent-bench.cc b/Libraries/libfluent/tools/fluent-bench.cc
index dcc98c8..6ab8ef6 100644
--- a/Libraries/libfluent/tools/fluent-bench.cc
+++ b/Libraries/libfluent/tools/fluent-bench.cc
@@ -46,7 +46,7 @@ int main(int argc, char *argv[]) {

   int wait = 1000000 / mps;
   time_t last_ts = time(nullptr);
-  size_t msg_count = 0;
+  int msg_count = 0;

   std::cout << "wait: " << wait << "usec" << std::endl;

Best regards,

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.