Hi there

I have a small sample test file, with one thread group (one thread),
looped a number of times (10 at the moment). with one BSF group,
configured to run a ruby script.

Everything surrounding the classpath has been configured, jmeter is
finding the jruby JARs, the jruby libraries and my own java code.

Now as far as I understand, the JMeterVariables object (which seems to
be exposed as $vars in the jruby environment), is shared between
successive samples inside a thread group. I understand that each
thread group runs in its own copy of the interpetrer, but as far as I
understand successive samples within a thread group share an
interpreter of the chosen language. Thus you can use this object to
share variables between test samples. Now this seems fine for sharing
simple numbers/strings - but what I want to do, is share a socket
instance between successive test samples, and this seems to break
somewhere, or I am misunderstanding.

Basically, I have the one thread group, looping 10 times. Inside, a
BSF group, running the following jruby script:

require 'socket'

if $vars.getObject("s") == nil
  s = TCPSocket.open("localhost", 6663)
  $vars.putObject("s",s)
end

begin
  socket = $vars.getObject("s")
  socket.send([1,2,3,4])
rescue => e
  puts "Error"
  puts e.message
end

I can see it working the first time, but after that, it fails with an exception:

    Bad file descriptor.

The output I get is basically this (note, I am running through the
chronos maven plugin here):
[INFO] Success
....
[INFO] Error
[INFO] Bad file descriptor - Bad file descriptor
....
[INFO] Error
[INFO] Bad file descriptor - Bad file descriptor

etc.

Should I not be using the $vars object to share something like this?
Is the interpreter in fact getting recreated? What am I
misunderstanding?

Thanks for any help, enlightenment, etc.

---------------------------------------------------------------------
To unsubscribe, e-mail: jmeter-user-unsubscr...@jakarta.apache.org
For additional commands, e-mail: jmeter-user-h...@jakarta.apache.org

Reply via email to