Giter Club home page Giter Club logo

javabeanstalkclient's People

Contributors

dependabot[bot] avatar rtykulsker avatar sgaide 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

Watchers

 avatar  avatar  avatar

javabeanstalkclient's Issues

ProtocolHandler dies because of random job data.

package cohadar.beantest;

import java.util.Random;

import org.testng.annotations.Test;

import com.surftools.BeanstalkClient.Client;
import com.surftools.BeanstalkClient.Job;
import com.surftools.BeanstalkClientImpl.ClientImpl;

public class TestBeanstalkd {

/**
 * For some reason protocol cannot handle random binary data.
 * Throws com.surftools.BeanstalkClient.BeanstalkException: �L�bbs�4Y�N�Sk|� (garbage)
 * */
@Test
public void deathByRandom() throws Exception {
    Client client = new ClientImpl();

    for (int i = 0; i < 100; i++) {
        byte[] jobData = new byte[20000];

        new Random().nextBytes(jobData);  // <------<< comment this line and it works fine

        long jid = client.put(0, 0, 0, jobData);
        System.out.println("Inserted:" + jid);

        Job job = client.reserve(-1); // blocking wait
        jid = job.getJobId();
        System.out.println("Deleting:" + jid);
        client.delete(jid);
    }
}

}

Exception on ignore

I get

java.lang.NumberFormatException: null
at java.lang.Integer.parseInt(Integer.java:443)
at java.lang.Integer.parseInt(Integer.java:514)
at com.surftools.BeanstalkClientImpl.ClientImpl.ignore(ClientImpl.java:202)

when I .ignore("default");

Line 202 is in ignore()

        return Integer.parseInt(response.getReponse());

Apparently the response can be null.

I'm using beanstalk client 1.2.2 patched for the Linux performance problem, and beanstalk 1.4.3-1 on Ubuntu.

BeanstalkClient 1.4.3 requires junit 4.X

The pom.xml says junit 3.8.1, and "mvn install" won't build the tests. I put in 4.2, and it builds. (A test fails, but I'm looking into that.)

$ diff pom.xml.orig pom.xml
14c14
<           <version>3.8.1</version>

---
>           <version>4.2</version>

BeanstalkClient 1.4.3: ClientImplTest comment

A small thing. One test I had to comment out:

    // underscores are now valid in tube names
    // try {
    //  client.useTube("foobar_");
    // } catch ( Exception e ) {
    //  fail(e.getMessage());
    // }

It would have been helpful to know _s are as of beanstalk 1.4.4: http://kr.github.com/beanstalkd/2010/03/09/1.4.4-release-notes.html. I'm running 1.4.3-1 because that's the latest Ubuntu 10.4 stable package.

Perhaps change the comment to

// underscores are valid in tube names >= beanstalk 1.4.4.

OutOfMemoryError if beanstalkd inaccessible during reserve()

Steps to reproduce:

  1. Start beanstalkd
  2. Client client = new ClientImpl("localhost", 11300);
     client.reserve(null);
    
  3. Stop beanstalkd

Inside ProtocolHandler.readInputStream in while loop code doesn't handle -1 returned from is.read(); Might be something like this:

        while (true) {
            byte b = (byte) is.read();

            if (b == -1) {
                throw new IOException("The end of InputStream is reached");
            }
            baos.write(b);
            if (b == '\n' && lastByteWasReturnByte) {
                break;
            }
            lastByteWasReturnByte = (b == '\r');
        }

java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Arrays.java:2786)
at java.io.ByteArrayOutputStream.write(ByteArrayOutputStream.java:71)
at com.surftools.BeanstalkClientImpl.ProtocolHandler.readInputStream(ProtocolHandler.java:130)
at com.surftools.BeanstalkClientImpl.ProtocolHandler.processRequest(ProtocolHandler.java:72)
at com.surftools.BeanstalkClientImpl.ClientImpl.reserve(ClientImpl.java:100)

BeanstalkClient 1.4.3: TimedPutTest fails

The puts look fine (0-1ms). However, I bet Maven or Junit thinks anything ending in "Test" needs a unit test, so it's saying:

<<< ERROR!
java.lang.Exception: No runnable methods
at org.junit.internal.runners.TestClassMethodsRunner.run(TestClassMethodsRunner.java:34)
...

I renamed to TimedPutTester, and it skips that file.

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.