[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#785478: jessie-pu: package node-groove/2.2.6-1



Package: release.debian.org
Severity: normal
Tags: jessie
User: release.debian.org@packages.debian.org
Usertags: pu

Dear release team,

Node-groove has a bug that is pretty annoying: a missing check in a loop
causes an almost-tight loop to run as long as an encoder object is
attached. More details at the upstream tracker[1]. This is not a
dealbreaker on multicore machines, but it is still annoying and pretty
bad in single-core machines.

We think the smallness of the fix and the greatness of the improvement
makes it good for a stable update. Please find attached the full diff
for the proposed upload.


[1] https://github.com/andrewrk/groovebasin/issues/319

-- System Information:
Debian Release: stretch/sid
  APT prefers unstable
  APT policy: (500, 'unstable'), (1, 'experimental')
Architecture: amd64 (x86_64)
Foreign Architectures: i386

Kernel: Linux 4.0.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: systemd (via /run/systemd/system)
diff --git a/debian/changelog b/debian/changelog
index 1e510e0..fc1c49f 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,9 @@
+node-groove (2.2.6-1+deb8u1) UNRELEASED; urgency=medium
+
+  * Backport patch to fix cpu usage
+
+ -- Felipe Sateler <fsateler@debian.org>  Fri, 15 May 2015 19:05:19 -0300
+
 node-groove (2.2.6-1) unstable; urgency=low
 
   * Update to upstream 2.2.6
diff --git a/debian/gbp.conf b/debian/gbp.conf
new file mode 100644
index 0000000..fae4302
--- /dev/null
+++ b/debian/gbp.conf
@@ -0,0 +1,2 @@
+[DEFAULT]
+debian-branch = jessie
diff --git a/debian/patches/0001-fix-emitting-buffer-event-too-often.patch b/debian/patches/0001-fix-emitting-buffer-event-too-often.patch
new file mode 100644
index 0000000..bbc5cb6
--- /dev/null
+++ b/debian/patches/0001-fix-emitting-buffer-event-too-often.patch
@@ -0,0 +1,62 @@
+From: Andrew Kelley <superjoe30@gmail.com>
+Date: Thu, 14 May 2015 09:28:25 -0700
+Subject: fix emitting 'buffer' event too often
+
+no longer burns the CPU
+---
+ src/gn_encoder.cc | 15 +++++++++++++--
+ src/gn_encoder.h  |  1 +
+ 2 files changed, 14 insertions(+), 2 deletions(-)
+
+diff --git a/src/gn_encoder.cc b/src/gn_encoder.cc
+index 0791292..474141f 100644
+--- a/src/gn_encoder.cc
++++ b/src/gn_encoder.cc
+@@ -93,7 +93,10 @@ static void EventThreadEntry(void *arg) {
+     GNEncoder::EventContext *context = reinterpret_cast<GNEncoder::EventContext *>(arg);
+     while (groove_encoder_buffer_peek(context->encoder, 1) > 0) {
+         uv_mutex_lock(&context->mutex);
+-        uv_async_send(&context->event_async);
++        if (context->emit_buffer_ok) {
++            context->emit_buffer_ok = false;
++            uv_async_send(&context->event_async);
++        }
+         uv_cond_wait(&context->cond, &context->mutex);
+         uv_mutex_unlock(&context->mutex);
+     }
+@@ -180,6 +183,7 @@ Handle<Value> GNEncoder::Create(const Arguments& args) {
+     GNEncoder *gn_encoder = node::ObjectWrap::Unwrap<GNEncoder>(instance);
+     EventContext *context = new EventContext;
+     gn_encoder->event_context = context;
++    context->emit_buffer_ok = true;
+     context->event_cb = Persistent<Function>::New(Local<Function>::Cast(args[0]));
+     context->encoder = encoder;
+ 
+@@ -372,7 +376,14 @@ Handle<Value> GNEncoder::GetBuffer(const Arguments& args) {
+     GrooveEncoder *encoder = gn_encoder->encoder;
+ 
+     GrooveBuffer *buffer;
+-    switch (groove_encoder_buffer_get(encoder, &buffer, 0)) {
++    int buf_result = groove_encoder_buffer_get(encoder, &buffer, 0);
++
++    uv_mutex_lock(&gn_encoder->event_context->mutex);
++    gn_encoder->event_context->emit_buffer_ok = true;
++    uv_cond_signal(&gn_encoder->event_context->cond);
++    uv_mutex_unlock(&gn_encoder->event_context->mutex);
++
++    switch (buf_result) {
+         case GROOVE_BUFFER_YES: {
+             Local<Object> object = Object::New();
+ 
+diff --git a/src/gn_encoder.h b/src/gn_encoder.h
+index 063bf60..958815e 100644
+--- a/src/gn_encoder.h
++++ b/src/gn_encoder.h
+@@ -19,6 +19,7 @@ class GNEncoder : public node::ObjectWrap {
+             uv_mutex_t mutex;
+             GrooveEncoder *encoder;
+             v8::Persistent<v8::Function> event_cb;
++            bool emit_buffer_ok;
+         };
+ 
+         GrooveEncoder *encoder;
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..3040e56
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1 @@
+0001-fix-emitting-buffer-event-too-often.patch

Reply to: