Re: [zeromq-dev] Frequent error messages

2013-03-12 Thread Gonzalo Vasquez
Yes, it's in the Mac side.-
Gonzalo Vásquez Sáez
Gerente Investigación y Desarrollo (RD)
Altiuz Soluciones Tecnológicas de Negocios Ltda.
Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
+56 2 335 2461
gvasq...@altiuz.cl
http://www.altiuz.cl
http://www.altiuzreports.com
  


El 11-03-2013, a las 22:59, Trevor Bernard trevor.bern...@gmail.com escribió:

 
 So aside, from a version number increase, and few changed comments, there 
 doesn't seem be any real software upgrade, i.e. no src files modified, am I 
 wrong?
  
 There should have been a few files changed:. This is the diff from the v2.1.2 
 tag with master:
 
 https://github.com/zeromq/jzmq/compare/v2.1.2...master
 
 Also I assume this was happening on the Mac client side since the error was 
 kqueue related?
 
 I try to reproduce on it from my Mac.
 
 -Trev 
 ___
 zeromq-dev mailing list
 zeromq-dev@lists.zeromq.org
 http://lists.zeromq.org/mailman/listinfo/zeromq-dev

___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Frequent error messages

2013-03-12 Thread Gonzalo Vasquez
That worked liked a charm!

I moved the context into the following line:

private Context ctx = ZMQ.context(1);

And commented out this line:

//ctx.term();

How being too clean would harm the context creation/termination process?

In this new scenario the context will never be terminated as it'll linger idle 
in the application (webapp) as long as the app is running. Is there some kind 
of cleansing process I could use to ensure stability?


Gonzalo Vásquez Sáez
Gerente Investigación y Desarrollo (RD)
Altiuz Soluciones Tecnológicas de Negocios Ltda.
Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
+56 2 335 2461
gvasq...@altiuz.cl
http://www.altiuz.cl
http://www.altiuzreports.com
  


El 11-03-2013, a las 23:25, Trevor Bernard trevor.bern...@gmail.com escribió:

 In your private byte[] getByte(...), I see that you create and destroy
 our context each time it's called. I would try creating only one
 context for your client process and see if that helps your
 reliability.
 
 http://zguide.zeromq.org/page:all#Getting-the-Context-Right
 
 -Trev
 
 On Mon, Mar 11, 2013 at 10:59 PM, Trevor Bernard
 trevor.bern...@gmail.com wrote:
 
 So aside, from a version number increase, and few changed comments, there
 doesn't seem be any real software upgrade, i.e. no src files modified, am I
 wrong?
 
 
 There should have been a few files changed:. This is the diff from the
 v2.1.2 tag with master:
 
 https://github.com/zeromq/jzmq/compare/v2.1.2...master
 
 Also I assume this was happening on the Mac client side since the error was
 kqueue related?
 
 I try to reproduce on it from my Mac.
 
 -Trev
 ___
 zeromq-dev mailing list
 zeromq-dev@lists.zeromq.org
 http://lists.zeromq.org/mailman/listinfo/zeromq-dev

___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Frequent error messages

2013-03-12 Thread Trevor Bernard
 That worked liked a charm!

Awesome!

 How being too clean would harm the context creation/termination process?

It seems there is something awry but someone more experienced with
libzmq would have to chime in.

 In this new scenario the context will never be terminated as it'll linger 
 idle in the application (webapp) as long as the app is running. Is there some 
 kind of cleansing process I could use to ensure stability?

I would create the context when the webapp starts and terminate it in
a shutdown hook when your webapp is closed.
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Frequent error messages

2013-03-12 Thread Gonzalo Vasquez
Shutdown hook.....I'll have to check on that.

I'll keep stressing the app and reports if there are any more hiccups around ;)

Thanks!


Gonzalo Vásquez Sáez
Gerente Investigación y Desarrollo (RD)
Altiuz Soluciones Tecnológicas de Negocios Ltda.
Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
+56 2 335 2461
gvasq...@altiuz.cl
http://www.altiuz.cl
http://www.altiuzreports.com
  


El 12-03-2013, a las 9:28, Trevor Bernard trevor.bern...@gmail.com escribió:

 That worked liked a charm!
 
 Awesome!
 
 How being too clean would harm the context creation/termination process?
 
 It seems there is something awry but someone more experienced with
 libzmq would have to chime in.
 
 In this new scenario the context will never be terminated as it'll linger 
 idle in the application (webapp) as long as the app is running. Is there 
 some kind of cleansing process I could use to ensure stability?
 
 I would create the context when the webapp starts and terminate it in
 a shutdown hook when your webapp is closed.
 ___
 zeromq-dev mailing list
 zeromq-dev@lists.zeromq.org
 http://lists.zeromq.org/mailman/listinfo/zeromq-dev

___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Frequent error messages

2013-03-11 Thread Gonzalo Vasquez
I've just downloaded a new ZIP from the GIT repository, and found out that the 
pom.xml file says 2.1.3-snapshot. Used diff to compare files with the prior 
version I had and the output was the following:

diff jzmq-master jzmq-master 2
Only in jzmq-master: .DS_Store
diff jzmq-master/INSTALL jzmq-master 2/INSTALL
4c4
 Copyright (C) 1994-1996, 1999-2002, 2004-2012 Free Software Foundation,
---
 Copyright (C) 1994-1996, 1999-2002, 2004-2011 Free Software Foundation,
312,313c312
 an Autoconf limitation.  Until the limitation is lifted, you can use
 this workaround:
---
 an Autoconf bug.  Until the bug is fixed you can use this workaround:
315c314
  CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
---
  CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
370a370
 
Only in jzmq-master: Makefile
Only in jzmq-master: Makefile.in
Only in jzmq-master: aclocal.m4
Only in jzmq-master: autom4te.cache
Common subdirectories: jzmq-master/builds and jzmq-master 2/builds
Common subdirectories: jzmq-master/config and jzmq-master 2/config
Only in jzmq-master: config.log
Only in jzmq-master: config.status
Only in jzmq-master: configure
Common subdirectories: jzmq-master/debian and jzmq-master 2/debian
Only in jzmq-master: libtool
Common subdirectories: jzmq-master/perf and jzmq-master 2/perf
diff jzmq-master/pom.xml jzmq-master 2/pom.xml
11c11
 version2.1.2-SNAPSHOT/version
---
 version2.1.3-SNAPSHOT/version
Common subdirectories: jzmq-master/src and jzmq-master 2/src
Common subdirectories: jzmq-master/test and jzmq-master 2/test


So aside, from a version number increase, and few changed comments, there 
doesn't seem be any real software upgrade, i.e. no src files modified, am I 
wrong?

PS: The other different files, and the ones that don't exist are due to the 
fact that I've already built the library on that folder.
Gonzalo Vásquez Sáez
Gerente Investigación y Desarrollo (RD)
Altiuz Soluciones Tecnológicas de Negocios Ltda.
Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
+56 2 335 2461
gvasq...@altiuz.cl
http://www.altiuz.cl
http://www.altiuzreports.com
  


El 08-03-2013, a las 12:06, Trevor Bernard trevor.bern...@gmail.com escribió:

 Hi Gonzalo,
 
 Can you try building the latest from jzmq master? Not knowing what 
 2.1.2-SNAPSHOT you have, I can't be certain which fixes are included in your 
 version.
 
 These issues might be contributing to your stability problems that have since 
 been resolved:
 
 - https://github.com/zeromq/jzmq/issues/174
 - https://github.com/zeromq/jzmq/issues/186
 
 Also, I'm working on build more stable/interruptible zmq devices.
 
 From looking at your code, you're basically use the zmq queue device. Here is 
 my WIP for the queue device:
 
 https://github.com/trevorbernard/jzmq/commit/8ff283764340758159ab915afcbbe87894882a31
 
 This is completely untested but I intend to finalize it over the weekend.
 
 Warmest regards,
 
 Trev
 On Fri, Mar 8, 2013 at 7:57 AM, Gonzalo Vasquez gvasq...@altiuz.cl wrote:
 Dear Min,
 
 File pom.xml inside jzmq-master.zip says 2.1.2-SNAPSHOT
 
 ZMQ is the latest, i.e. 3.2.2
 
 Gonzalo Vásquez Sáez
 Gerente Investigación y Desarrollo (RD)
 Altiuz Soluciones Tecnológicas de Negocios Ltda.
 Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
 +56 2 335 2461
 gvasq...@altiuz.cl
 http://www.altiuz.cl
 http://www.altiuzreports.com
   
 
 
 El 07-03-2013, a las 22:59, Min mini...@gmail.com escribió:
 
 Hi, 
 
 And what version of jzmq and libzmq did you 
 use?
 
 Thanks
 Min
 
 2013년 3월 7일 목요일에 Gonzalo Vasquez님이 작성:
 This is the client side code that I use to communicate with the server:
 
  private byte[] getByte(final String table, final String name,
  final int doc_off, final int doc_len, final int 
 comp_off,
  final int comp_len, final char compressionType) throws 
 Exception {
  File file = new File(cacheRoot, table.substring(0, 3) + /DOC/ 
 + name); //$NON-NLS-1$
  Context ctx = ZMQ.context(1);
 
  Socket req = ctx.socket(ZMQ.REQ);
  req.connect(ENDPOINT);
 
  // TODO Crear POJO en vez de Map
  MapString, String params = new HashMapString, String();
  params.put(path, file.getAbsolutePath());
  params.put(dOff, String.valueOf(doc_off));
  params.put(dLen, String.valueOf(doc_len));
  params.put(cOff, String.valueOf(comp_off));
  params.put(clen, String.valueOf(comp_len));
  params.put(cType, String.valueOf(compressionType));
 
  ByteArrayOutputStream baos = new ByteArrayOutputStream();
  ObjectOutputStream oos = new ObjectOutputStream(baos);
  oos.writeObject(params);
  oos.close();
  params.clear();
  baos.close();
 
  req.send(baos.toByteArray(), NO_FLAGS);
  byte[] data = req.recv();
  req.close();
  

Re: [zeromq-dev] Frequent error messages

2013-03-11 Thread Trevor Bernard
 So aside, from a version number increase, and few changed comments, there
 doesn't seem be any real software upgrade, i.e. no src files modified, am I
 wrong?


There should have been a few files changed:. This is the diff from the
v2.1.2 tag with master:

https://github.com/zeromq/jzmq/compare/v2.1.2...master

Also I assume this was happening on the Mac client side since the error was
kqueue related?

I try to reproduce on it from my Mac.

-Trev
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Frequent error messages

2013-03-11 Thread Trevor Bernard
In your private byte[] getByte(...), I see that you create and destroy
our context each time it's called. I would try creating only one
context for your client process and see if that helps your
reliability.

http://zguide.zeromq.org/page:all#Getting-the-Context-Right

-Trev

On Mon, Mar 11, 2013 at 10:59 PM, Trevor Bernard
trevor.bern...@gmail.com wrote:

 So aside, from a version number increase, and few changed comments, there
 doesn't seem be any real software upgrade, i.e. no src files modified, am I
 wrong?


 There should have been a few files changed:. This is the diff from the
 v2.1.2 tag with master:

 https://github.com/zeromq/jzmq/compare/v2.1.2...master

 Also I assume this was happening on the Mac client side since the error was
 kqueue related?

 I try to reproduce on it from my Mac.

 -Trev
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Frequent error messages

2013-03-08 Thread Gonzalo Vasquez
Dear Min,

File pom.xml inside jzmq-master.zip says 2.1.2-SNAPSHOT

ZMQ is the latest, i.e. 3.2.2

Gonzalo Vásquez Sáez
Gerente Investigación y Desarrollo (RD)
Altiuz Soluciones Tecnológicas de Negocios Ltda.
Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
+56 2 335 2461
gvasq...@altiuz.cl
http://www.altiuz.cl
http://www.altiuzreports.com
  


El 07-03-2013, a las 22:59, Min mini...@gmail.com escribió:

 Hi, 
 
 And what version of jzmq and libzmq did you 
 use?
 
 Thanks
 Min
 
 2013년 3월 7일 목요일에 Gonzalo Vasquez님이 작성:
 This is the client side code that I use to communicate with the server:
 
   private byte[] getByte(final String table, final String name,
   final int doc_off, final int doc_len, final int 
 comp_off,
   final int comp_len, final char compressionType) throws 
 Exception {
   File file = new File(cacheRoot, table.substring(0, 3) + /DOC/ 
 + name); //$NON-NLS-1$
   Context ctx = ZMQ.context(1);
 
   Socket req = ctx.socket(ZMQ.REQ);
   req.connect(ENDPOINT);
 
   // TODO Crear POJO en vez de Map
   MapString, String params = new HashMapString, String();
   params.put(path, file.getAbsolutePath());
   params.put(dOff, String.valueOf(doc_off));
   params.put(dLen, String.valueOf(doc_len));
   params.put(cOff, String.valueOf(comp_off));
   params.put(clen, String.valueOf(comp_len));
   params.put(cType, String.valueOf(compressionType));
 
   ByteArrayOutputStream baos = new ByteArrayOutputStream();
   ObjectOutputStream oos = new ObjectOutputStream(baos);
   oos.writeObject(params);
   oos.close();
   params.clear();
   baos.close();
 
   req.send(baos.toByteArray(), NO_FLAGS);
   byte[] data = req.recv();
   req.close();
   ctx.term();
   return data;
   }
 
 
 And on the server side I use the three attached classes
 
 public void run() {
   // Prepare our context and sockets
   Context context = ZMQ.context(1);
   Socket frontend = context.socket(ZMQ.ROUTER);
   Socket backend = context.socket(ZMQ.DEALER);
   frontend.bind(tcp://*:5559);
   backend.bind(inproc://workers);
 
   Thread threads[] = new Thread[workers];
   for (int i = 0; i  threads.length; i++) {
   threads[i] = new WorkerThread(i, context);
   threads[i].start();
   }
   System.out.println(launch and connect broker.);
 
   // Initialize poll set
   Poller items = context.poller(2);
   items.register(frontend, Poller.POLLIN);
   items.register(backend, Poller.POLLIN);
 
   boolean more = false;
   byte[] message;
 
   // Switch messages between sockets
   try {
   while (!Thread.currentThread().isInterrupted()) {
   // poll and memorize multipart detection
   items.poll();
 
   if (items.pollin(0)) {
   while (true) {
   // receive message
   message = frontend.recv(0);
   more = 
 frontend.hasReceiveMore();
 
   // Broker it
   backend.send(message, more ? 
 ZMQ.SNDMORE : 0);
   if (!more) {
   break;
   }
   }
   }
   if (items.pollin(1)) {
   while (true) {
   // receive message
   message = backend.recv(0);
   more = backend.hasReceiveMore();
   // Broker it
   frontend.send(message, more ? 
 ZMQ.SNDMORE : 0);
   if (!more) {
   break;
   }
   }
   }
   }
   } finally {
   // We never get here but clean up anyhow
   frontend.close();
   backend.close();
   context.term();
   }
   }
 
 Does 

Re: [zeromq-dev] Frequent error messages

2013-03-08 Thread Trevor Bernard
Hi Gonzalo,

Can you try building the latest from jzmq master? Not knowing what
2.1.2-SNAPSHOT you have, I can't be certain which fixes are included in
your version.

These issues might be contributing to your stability problems that have
since been resolved:

- https://github.com/zeromq/jzmq/issues/174
- https://github.com/zeromq/jzmq/issues/186

Also, I'm working on build more stable/interruptible zmq devices.

From looking at your code, you're basically use the zmq queue device. Here
is my WIP for the queue device:

https://github.com/trevorbernard/jzmq/commit/8ff283764340758159ab915afcbbe87894882a31

This is completely untested but I intend to finalize it over the weekend.

Warmest regards,

Trev
On Fri, Mar 8, 2013 at 7:57 AM, Gonzalo Vasquez gvasq...@altiuz.cl wrote:

 Dear Min,

 File pom.xml inside jzmq-master.zip says 2.1.2-SNAPSHOT

 ZMQ is the latest, i.e. 3.2.2

   Gonzalo Vásquez Sáez
 Gerente Investigación y Desarrollo (RD)
 Altiuz Soluciones Tecnológicas de Negocios Ltda.
 Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
 +56 2 335 2461
   gvasq...@altiuz.cl
 http://www.altiuz.cl
 http://www.altiuzreports.com
   https://www.facebook.com/altiuz  http://twitter.com/altiuz 
 http://www.linkedin.com/company/altiuz

 El 07-03-2013, a las 22:59, Min mini...@gmail.com escribió:

 Hi,

 And what version of jzmq and libzmq did you
 use?

 Thanks
 Min

 2013년 3월 7일 목요일에 Gonzalo Vasquez님이 작성:

 This is the client side code that I use to communicate with the server:

 private byte[] getByte(final String table, final String name,
  final int doc_off, final int doc_len, final int comp_off,
  final int comp_len, final char compressionType) throws Exception {
  File file = new File(cacheRoot, table.substring(0, 3) + /DOC/ +
 name); //$NON-NLS-1$
  Context ctx = ZMQ.context(1);

  Socket req = ctx.socket(ZMQ.REQ);
  req.connect(ENDPOINT);

  // TODO Crear POJO en vez de Map
  MapString, String params = new HashMapString, String();
  params.put(path, file.getAbsolutePath());
 params.put(dOff, String.valueOf(doc_off));
  params.put(dLen, String.valueOf(doc_len));
  params.put(cOff, String.valueOf(comp_off));
 params.put(clen, String.valueOf(comp_len));
  params.put(cType, String.valueOf(compressionType));

 ByteArrayOutputStream baos = new ByteArrayOutputStream();
  ObjectOutputStream oos = new ObjectOutputStream(baos);
 oos.writeObject(params);
  oos.close();
 params.clear();
  baos.close();

  req.send(baos.toByteArray(), NO_FLAGS);
 byte[] data = req.recv();
  req.close();
 ctx.term();
  return data;
 }


 And on the server side I use the three attached classes

 public void run() {
  // Prepare our context and sockets
  Context context = ZMQ.context(1);
 Socket frontend = context.socket(ZMQ.ROUTER);
  Socket backend = context.socket(ZMQ.DEALER);
  frontend.bind(tcp://*:5559);
 backend.bind(inproc://workers);

 Thread threads[] = new Thread[workers];
  for (int i = 0; i  threads.length; i++) {
  threads[i] = new WorkerThread(i, context);
  threads[i].start();
 }
  System.out.println(launch and connect broker.);

 // Initialize poll set
  Poller items = context.poller(2);
  items.register(frontend, Poller.POLLIN);
  items.register(backend, Poller.POLLIN);

  boolean more = false;
  byte[] message;

  // Switch messages between sockets
 try {
  while (!Thread.currentThread().isInterrupted()) {
  // poll and memorize multipart detection
  items.poll();

 if (items.pollin(0)) {
  while (true) {
  // receive message
 message = frontend.recv(0);
  more = frontend.hasReceiveMore();

  // Broker it
  backend.send(message, more ? ZMQ.SNDMORE : 0);
 if (!more) {
  break;
 }
  }
 }
  if (items.pollin(1)) {
  while (true) {
 // receive message
  message = backend.recv(0);
 more = backend.hasReceiveMore();
  // Broker it
  frontend.send(message, more ? ZMQ.SNDMORE : 0);
 if (!more) {
  break;
 }
  }
 }
  }
 } finally {
  // We never get here but clean up anyhow
  frontend.close();
 backend.close();
  context.term();
 }
  }

 Does that help solving the problem?
   Gonzalo Vásquez Sáez
 Gerente Investigación y Desarrollo (RD)
 Altiuz Soluciones Tecnológicas de Negocios Ltda.
 Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
 +56 2 335 2461
   gvasq...@altiuz.cl
 http://www.altiuz.cl
 http://www.altiuzreports.com
   https://www.facebook.com/altiuz  http://twitter.com/altiuz 
 http://www.linkedin.com/company/altiuz

 El 05-03-2013, a las 18:19, Pieter Hintjens p...@imatix.com escribió:


 On Tue, Mar 5, 2013 at 9:57 PM, Gonzalo Vasquez gvasq...@altiuz.clwrote:

 Hi there!

 Upon stressing a Java / ZMQ based piece of software, I'm getting TWO
 repeated errors every now and then, they are:


 Hi Gonzalo,

 As with any error you're trying to report (to any project, I guess), the
 best tool is a minimal (I can't emphasize that enough) test case that
 provokes the crash. If you can make this in Java we can recreate it in C,
 and see where the problem is.

 The test case is essential to fixing the problem since after 

Re: [zeromq-dev] Frequent error messages

2013-03-08 Thread Gonzalo Vásquez
Trevor,

That snapshot was downloaded last week, nevertheless, I'll do as instructed.

Regards,

Gonzalo 

Enviado desde mi iPhone

El 08-03-2013, a las 12:06, Trevor Bernard trevor.bern...@gmail.com escribió:

 Hi Gonzalo,
 
 Can you try building the latest from jzmq master? Not knowing what 
 2.1.2-SNAPSHOT you have, I can't be certain which fixes are included in your 
 version.
 
 These issues might be contributing to your stability problems that have since 
 been resolved:
 
 - https://github.com/zeromq/jzmq/issues/174
 - https://github.com/zeromq/jzmq/issues/186
 
 Also, I'm working on build more stable/interruptible zmq devices.
 
 From looking at your code, you're basically use the zmq queue device. Here is 
 my WIP for the queue device:
 
 https://github.com/trevorbernard/jzmq/commit/8ff283764340758159ab915afcbbe87894882a31
 
 This is completely untested but I intend to finalize it over the weekend.
 
 Warmest regards,
 
 Trev
 On Fri, Mar 8, 2013 at 7:57 AM, Gonzalo Vasquez gvasq...@altiuz.cl wrote:
 Dear Min,
 
 File pom.xml inside jzmq-master.zip says 2.1.2-SNAPSHOT
 
 ZMQ is the latest, i.e. 3.2.2
 
 Gonzalo Vásquez Sáez
 Gerente Investigación y Desarrollo (RD)
 Altiuz Soluciones Tecnológicas de Negocios Ltda.
 Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
 +56 2 335 2461
 gvasq...@altiuz.cl
 http://www.altiuz.cl
 http://www.altiuzreports.com
   
 
 
 El 07-03-2013, a las 22:59, Min mini...@gmail.com escribió:
 
 Hi, 
 
 And what version of jzmq and libzmq did you 
 use?
 
 Thanks
 Min
 
 2013년 3월 7일 목요일에 Gonzalo Vasquez님이 작성:
 This is the client side code that I use to communicate with the server:
 
private byte[] getByte(final String table, final String name,
final int doc_off, final int doc_len, final int 
 comp_off,
final int comp_len, final char compressionType) throws 
 Exception {
File file = new File(cacheRoot, table.substring(0, 3) + /DOC/ 
 + name); //$NON-NLS-1$
Context ctx = ZMQ.context(1);
 
Socket req = ctx.socket(ZMQ.REQ);
req.connect(ENDPOINT);
 
// TODO Crear POJO en vez de Map
MapString, String params = new HashMapString, String();
params.put(path, file.getAbsolutePath());
params.put(dOff, String.valueOf(doc_off));
params.put(dLen, String.valueOf(doc_len));
params.put(cOff, String.valueOf(comp_off));
params.put(clen, String.valueOf(comp_len));
params.put(cType, String.valueOf(compressionType));
 
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos = new ObjectOutputStream(baos);
oos.writeObject(params);
oos.close();
params.clear();
baos.close();
 
req.send(baos.toByteArray(), NO_FLAGS);
byte[] data = req.recv();
req.close();
ctx.term();
return data;
}
 
 
 And on the server side I use the three attached classes
 
 public void run() {
// Prepare our context and sockets
Context context = ZMQ.context(1);
Socket frontend = context.socket(ZMQ.ROUTER);
Socket backend = context.socket(ZMQ.DEALER);
frontend.bind(tcp://*:5559);
backend.bind(inproc://workers);
 
Thread threads[] = new Thread[workers];
for (int i = 0; i  threads.length; i++) {
threads[i] = new WorkerThread(i, context);
threads[i].start();
}
System.out.println(launch and connect broker.);
 
// Initialize poll set
Poller items = context.poller(2);
items.register(frontend, Poller.POLLIN);
items.register(backend, Poller.POLLIN);
 
boolean more = false;
byte[] message;
 
// Switch messages between sockets
try {
while (!Thread.currentThread().isInterrupted()) {
// poll and memorize multipart detection
items.poll();
 
if (items.pollin(0)) {
while (true) {
// receive message
message = frontend.recv(0);
more = 
 frontend.hasReceiveMore();
 
// Broker it
backend.send(message, more ? 
 ZMQ.SNDMORE : 0);
if (!more) {
break;
}
}
}
if (items.pollin(1)) {
while (true) {

Re: [zeromq-dev] Frequent error messages

2013-03-07 Thread Gonzalo Vasquez
This is the client side code that I use to communicate with the server:	private byte[] getByte(final String table, final String name,			final int doc_off, final int doc_len, final int comp_off,			final int comp_len, final char compressionType) throws Exception {		File file = new File(cacheRoot, table.substring(0, 3) + "/DOC/" + name); //$NON-NLS-1$		Context ctx = ZMQ.context(1);		Socket req = ctx.socket(ZMQ.REQ);		req.connect(ENDPOINT);		// TODO Crear POJO en vez de Map		MapString, String params = new HashMapString, String();		params.put("path", file.getAbsolutePath());		params.put("dOff", String.valueOf(doc_off));		params.put("dLen", String.valueOf(doc_len));		params.put("cOff", String.valueOf(comp_off));		params.put("clen", String.valueOf(comp_len));		params.put("cType", String.valueOf(compressionType));		ByteArrayOutputStream baos = new ByteArrayOutputStream();		ObjectOutputStream oos = new ObjectOutputStream(baos);		oos.writeObject(params);		oos.close();		params.clear();		baos.close();		req.send(baos.toByteArray(), NO_FLAGS);		byte[] data = "">		req.close();		ctx.term();		return data;	}And on the server side I use the three attached classespublic void run() {		// Prepare our context and sockets		Context context = ZMQ.context(1);		Socket frontend = context.socket(ZMQ.ROUTER);		Socket backend = context.socket(ZMQ.DEALER);		frontend.bind("tcp://*:5559");		backend.bind("inproc://workers");		Thread threads[] = new Thread[workers];		for (int i = 0; i  threads.length; i++) {			threads[i] = new WorkerThread(i, context);			threads[i].start();		}		System.out.println("launch and connect broker.");		// Initialize poll set		Poller items = context.poller(2);		items.register(frontend, Poller.POLLIN);		items.register(backend, Poller.POLLIN);		boolean more = false;		byte[] message;		// Switch messages between sockets		try {			while (!Thread.currentThread().isInterrupted()) {// poll and memorize multipart detectionitems.poll();if (items.pollin(0)) {	while (true) {		// receive message		message = frontend.recv(0);		more = frontend.hasReceiveMore();		// Broker it		backend.send(message, more ? ZMQ.SNDMORE : 0);		if (!more) {			break;		}	}}if (items.pollin(1)) {	while (true) {		// receive message		message = backend.recv(0);		more = backend.hasReceiveMore();		// Broker it		frontend.send(message, more ? ZMQ.SNDMORE : 0);		if (!more) {			break;		}	}}			}		} finally {			// We never get here but clean up anyhow			frontend.close();			backend.close();			context.term();		}	}Does that help solving the problem?



Gonzalo Vásquez Sáez
Gerente Investigación y Desarrollo (RD)
Altiuz Soluciones Tecnológicas de Negocios Ltda.
Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
+56 2 335 2461



gvasq...@altiuz.cl
http://www.altiuz.cl
http://www.altiuzreports.com













El 05-03-2013, a las 18:19, Pieter Hintjens p...@imatix.com escribió:On Tue, Mar 5, 2013 at 9:57 PM, Gonzalo Vasquez gvasq...@altiuz.cl wrote:

Hi there!Upon stressing a Java / ZMQ based piece of software, I'm getting TWO repeated errors every now and then, they are:

Hi Gonzalo,As with any error you're trying to report (to any project, I guess), the best tool is a minimal (I can't emphasize that enough) test case that provokes the crash. If you can make this in Java we can recreate it in C, and see where the problem is.

The test case is essential to fixing the problem since after we fix it we have to run the same test case to be 100% the problem is gone.

-Pieter
___zeromq-dev mailing listzeromq-dev@lists.zeromq.orghttp://lists.zeromq.org/mailman/listinfo/zeromq-dev

ObjetoRemoto.java
Description: Binary data


Server.java
Description: Binary data


WorkerThread.java
Description: Binary data
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Frequent error messages

2013-03-07 Thread Min
Hi,

And what version of jzmq and libzmq did you
use?

Thanks
Min

2013년 3월 7일 목요일에 Gonzalo Vasquez님이 작성:

 This is the client side code that I use to communicate with the server:

 private byte[] getByte(final String table, final String name,
 final int doc_off, final int doc_len, final int comp_off,
 final int comp_len, final char compressionType) throws Exception {
 File file = new File(cacheRoot, table.substring(0, 3) + /DOC/ + name);
 //$NON-NLS-1$
 Context ctx = ZMQ.context(1);

 Socket req = ctx.socket(ZMQ.REQ);
 req.connect(ENDPOINT);

 // TODO Crear POJO en vez de Map
 MapString, String params = new HashMapString, String();
 params.put(path, file.getAbsolutePath());
 params.put(dOff, String.valueOf(doc_off));
 params.put(dLen, String.valueOf(doc_len));
 params.put(cOff, String.valueOf(comp_off));
 params.put(clen, String.valueOf(comp_len));
 params.put(cType, String.valueOf(compressionType));

 ByteArrayOutputStream baos = new ByteArrayOutputStream();
 ObjectOutputStream oos = new ObjectOutputStream(baos);
 oos.writeObject(params);
 oos.close();
 params.clear();
 baos.close();

 req.send(baos.toByteArray(), NO_FLAGS);
 byte[] data = req.recv();
 req.close();
 ctx.term();
 return data;
 }


 And on the server side I use the three attached classes

 public void run() {
 // Prepare our context and sockets
 Context context = ZMQ.context(1);
 Socket frontend = context.socket(ZMQ.ROUTER);
 Socket backend = context.socket(ZMQ.DEALER);
 frontend.bind(tcp://*:5559);
 backend.bind(inproc://workers);

 Thread threads[] = new Thread[workers];
 for (int i = 0; i  threads.length; i++) {
 threads[i] = new WorkerThread(i, context);
 threads[i].start();
 }
 System.out.println(launch and connect broker.);

 // Initialize poll set
 Poller items = context.poller(2);
 items.register(frontend, Poller.POLLIN);
 items.register(backend, Poller.POLLIN);

 boolean more = false;
 byte[] message;

 // Switch messages between sockets
 try {
 while (!Thread.currentThread().isInterrupted()) {
 // poll and memorize multipart detection
 items.poll();

 if (items.pollin(0)) {
 while (true) {
 // receive message
 message = frontend.recv(0);
 more = frontend.hasReceiveMore();

 // Broker it
 backend.send(message, more ? ZMQ.SNDMORE : 0);
 if (!more) {
 break;
 }
 }
 }
 if (items.pollin(1)) {
 while (true) {
 // receive message
 message = backend.recv(0);
 more = backend.hasReceiveMore();
 // Broker it
 frontend.send(message, more ? ZMQ.SNDMORE : 0);
 if (!more) {
 break;
 }
 }
 }
 }
 } finally {
 // We never get here but clean up anyhow
 frontend.close();
 backend.close();
 context.term();
 }
 }

 Does that help solving the problem?
   Gonzalo Vásquez Sáez
 Gerente Investigación y Desarrollo (RD)
 Altiuz Soluciones Tecnológicas de Negocios Ltda.
 Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
 +56 2 335 2461
   gvasq...@altiuz.cl javascript:_e({}, 'cvml', 'gvasq...@altiuz.cl');
 http://www.altiuz.cl
 http://www.altiuzreports.com
   https://www.facebook.com/altiuz  http://twitter.com/altiuz 
 http://www.linkedin.com/company/altiuz

 El 05-03-2013, a las 18:19, Pieter Hintjens 
 p...@imatix.comjavascript:_e({}, 'cvml', 'p...@imatix.com');
 escribió:


 On Tue, Mar 5, 2013 at 9:57 PM, Gonzalo Vasquez 
 gvasq...@altiuz.cljavascript:_e({}, 'cvml', 'gvasq...@altiuz.cl');
  wrote:

 Hi there!

 Upon stressing a Java / ZMQ based piece of software, I'm getting TWO
 repeated errors every now and then, they are:


 Hi Gonzalo,

 As with any error you're trying to report (to any project, I guess), the
 best tool is a minimal (I can't emphasize that enough) test case that
 provokes the crash. If you can make this in Java we can recreate it in C,
 and see where the problem is.

 The test case is essential to fixing the problem since after we fix it we
 have to run the same test case to be 100% the problem is gone.

 -Pieter

 ___
 zeromq-dev mailing list
 zeromq-dev@lists.zeromq.org javascript:_e({}, 'cvml',
 'zeromq-dev@lists.zeromq.org');
 http://lists.zeromq.org/mailman/listinfo/zeromq-dev


___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


[zeromq-dev] Frequent error messages

2013-03-05 Thread Gonzalo Vasquez
Hi there!

Upon stressing a Java / ZMQ based piece of software, I'm getting TWO repeated 
errors every now and then, they are:

Bad file descriptor (kqueue.cpp:76)
Resource busy (./mutex.hpp:90)
I'm using a request/reply schema from the client point of view (Mac OSX Darwin 
Kernel Version 12.2.0:xnu-2050.18.24~1/RELEASE_X86_64 x86_64, jdk 1.6.0), and a 
ROUTER/DEALER/WORKERS schema in the server side (CentOS Linux 6.2 kernel 
2.6.32-220.el6.x86_64, Sun Java build 1.6.0_39-b04).

ZMQ  Java bindings where built last week.

What additional details should I provide?


Gonzalo Vásquez Sáez
Gerente Investigación y Desarrollo (RD)
Altiuz Soluciones Tecnológicas de Negocios Ltda.
Av. Nueva Tajamar 555 Of. 802, Las Condes - CP 7550099
+56 2 335 2461
gvasq...@altiuz.cl
http://www.altiuz.cl
http://www.altiuzreports.com
  


___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Frequent error messages

2013-03-05 Thread Pieter Hintjens
On Tue, Mar 5, 2013 at 9:57 PM, Gonzalo Vasquez gvasq...@altiuz.cl wrote:

 Hi there!

 Upon stressing a Java / ZMQ based piece of software, I'm getting TWO
 repeated errors every now and then, they are:


Hi Gonzalo,

As with any error you're trying to report (to any project, I guess), the
best tool is a minimal (I can't emphasize that enough) test case that
provokes the crash. If you can make this in Java we can recreate it in C,
and see where the problem is.

The test case is essential to fixing the problem since after we fix it we
have to run the same test case to be 100% the problem is gone.

-Pieter
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev


Re: [zeromq-dev] Frequent error messages

2013-03-05 Thread Gonzalo Vásquez
Ok, minimal might be a problem, but I'll try to achieve that

Enviado desde mi iPhone

El 05-03-2013, a las 18:19, Pieter Hintjens p...@imatix.com escribió:

 
 On Tue, Mar 5, 2013 at 9:57 PM, Gonzalo Vasquez gvasq...@altiuz.cl wrote:
 Hi there!
 
 Upon stressing a Java / ZMQ based piece of software, I'm getting TWO 
 repeated errors every now and then, they are:
 
 Hi Gonzalo,
 
 As with any error you're trying to report (to any project, I guess), the best 
 tool is a minimal (I can't emphasize that enough) test case that provokes the 
 crash. If you can make this in Java we can recreate it in C, and see where 
 the problem is.
 
 The test case is essential to fixing the problem since after we fix it we 
 have to run the same test case to be 100% the problem is gone.
 
 -Pieter
 
 ___
 zeromq-dev mailing list
 zeromq-dev@lists.zeromq.org
 http://lists.zeromq.org/mailman/listinfo/zeromq-dev
___
zeromq-dev mailing list
zeromq-dev@lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev