I'm using pika in a kubernetes cluster and consuming messages from a queue, which triggers initiating a function in a new thread. However RabbitMQ seems crash, these are the best logs I've found so far:
2020-12-23 10:39:10,906] WARNING - WRITE indicated on fd=9, but writer callback is None; events=0b100 {/usr/local/lib/python3.9/site-packages/pika/adapters/utils/selector_ioloop_adapter.py:393}
(repeats to a total of n=38 times)
2020-12-23 10:39:10,908] ERROR - _AsyncBaseTransport._produce() failed, aborting connection: error=IndexError('pop from an empty deque'); sock=<socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.100.200', 44892), raddr=('192.168.101.201', 5672)>; Caller's stack:
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/pika/adapters/utils/io_services_utils.py", line 1097, in _on_socket_writable
self._produce()
File "/usr/local/lib/python3.9/site-packages/pika/adapters/utils/io_services_utils.py", line 822, in _produce
chunk = self._tx_buffers.popleft()
IndexError: pop from an empty deque
{/usr/local/lib/python3.9/site-packages/pika/adapters/utils/io_services_utils.py:1103}
Traceback (most recent call last):
File "/usr/local/lib/python3.9/site-packages/pika/adapters/utils/io_services_utils.py", line 1097, in _on_socket_writable
self._produce()
File "/usr/local/lib/python3.9/site-packages/pika/adapters/utils/io_services_utils.py", line 822, in _produce
chunk = self._tx_buffers.popleft()
IndexError: pop from an empty deque
2020-12-23 10:39:10,908] INFO - _AsyncTransportBase._initate_abort(): Initiating abrupt asynchronous transport shutdown: state=1; error=IndexError('pop from an empty deque'); <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.100.200', 44892), raddr=('192.168.101.201', 5672)> {/usr/local/lib/python3.9/site-packages/pika/adapters/utils/io_services_utils.py:904}
2020-12-23 10:39:10,908] INFO - Deactivating transport: state=1; <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.100.200', 44892), raddr=('192.168.101.201', 5672)> {/usr/local/lib/python3.9/site-packages/pika/adapters/utils/io_services_utils.py:869}
2020-12-23 10:39:10,909] ERROR - connection_lost: StreamLostError: ("Stream connection lost: IndexError('pop from an empty deque')",) {/usr/local/lib/python3.9/site-packages/pika/adapters/base_connection.py:428}
2020-12-23 10:39:10,909] INFO - AMQP stack terminated, failed to connect, or aborted: opened=True, error-arg=StreamLostError: ("Stream connection lost: IndexError('pop from an empty deque')",); pending-error=None {/usr/local/lib/python3.9/site-packages/pika/connection.py:1996}
2020-12-23 10:39:10,909] INFO - Stack terminated due to StreamLostError: ("Stream connection lost: IndexError('pop from an empty deque')",) {/usr/local/lib/python3.9/site-packages/pika/connection.py:2065}
2020-12-23 10:39:10,909] INFO - Closing transport socket and unlinking: state=2; <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.100.200', 44892), raddr=('192.168.101.201', 5672)> {/usr/local/lib/python3.9/site-packages/pika/adapters/utils/io_services_utils.py:882}
2020-12-23 10:39:10,909] ERROR - Unexpected connection close detected: StreamLostError: ("Stream connection lost: IndexError('pop from an empty deque')",) {/usr/local/lib/python3.9/site-packages/pika/adapters/blocking_connection.py:520}
2020-12-23 10:39:31,416] INFO - Pika version 1.1.0 connecting to ('192.168.101.201', 5672) {/usr/local/lib/python3.9/site-packages/pika/adapters/utils/connection_workflow.py:179}
2020-12-23 10:39:31,417] INFO - Socket connected: <socket.socket fd=9, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('192.168.100.200', 47142), raddr=('192.168.101.201', 5672)> {/usr/local/lib/python3.9/site-packages/pika/adapters/utils/io_services_utils.py:345}
2020-12-23 10:39:31,418] INFO - Streaming transport linked up: (<pika.adapters.utils.io_services_utils._AsyncPlaintextTransport object at 0x7f81b3099a60>, _StreamingProtocolShim: <SelectConnection PROTOCOL transport=<pika.adapters.utils.io_services_utils._AsyncPlaintextTransport object at 0x7f81b3099a60> params=<ConnectionParameters host=rabbitmq-0.rabbitmq.testing.svc.cluster.local port=5672 virtual_host=/ ssl=False>>). {/usr/local/lib/python3.9/site-packages/pika/adapters/utils/connection_workflow.py:428}
2020-12-23 10:39:31,421] INFO - AMQPConnector - reporting success: <SelectConnection OPEN transport=<pika.adapters.utils.io_services_utils._AsyncPlaintextTransport object at 0x7f81b3099a60> params=<ConnectionParameters host=rabbitmq-0.rabbitmq.testing.svc.cluster.local port=5672 virtual_host=/ ssl=False>> {/usr/local/lib/python3.9/site-packages/pika/adapters/utils/connection_workflow.py:293}
2020-12-23 10:39:31,421] INFO - AMQPConnectionWorkflow - reporting success: <SelectConnection OPEN transport=<pika.adapters.utils.io_services_utils._AsyncPlaintextTransport object at 0x7f81b3099a60> params=<ConnectionParameters host=rabbitmq-0.rabbitmq.testing.svc.cluster.local port=5672 virtual_host=/ ssl=False>> {/usr/local/lib/python3.9/site-packages/pika/adapters/utils/connection_workflow.py:725}
2020-12-23 10:39:31,421] INFO - Connection workflow succeeded: <SelectConnection OPEN transport=<pika.adapters.utils.io_services_utils._AsyncPlaintextTransport object at 0x7f81b3099a60> params=<ConnectionParameters host=rabbitmq-0.rabbitmq.testing.svc.cluster.local port=5672 virtual_host=/ ssl=False>> {/usr/local/lib/python3.9/site-packages/pika/adapters/blocking_connection.py:452}
2020-12-23 10:39:31,422] INFO - Created channel=1 {/usr/local/lib/python3.9/site-packages/pika/adapters/blocking_connection.py:1247
}
My consumer has the following definition:
def publish_message(channel, message):
channel.basic_publish(exchange='',
routing_key='my_queue',
body=message)
def connect_to_mq():
credentials = pika.PlainCredentials(rabbit_user, rabbit_password)
parameters = pika.ConnectionParameters(rabbit_host, rabbit_port, '/', credentials)
connection = pika.BlockingConnection(parameters=parameters)
channel = connection.channel()
channel.queue_declare(queue='my_queue')
return connection, channel
def on_message(channel, method_frame, header_frame, body):
message = body.decode('utf-8')
if message == 'do_work':
thread = threading.Thread(target=start_processing, args=(channel,))
thread.start()
publish_message(channel, 'initiated thread')
def start_processing(channel):
publish_message(channel, 'starting...')
time.sleep(240)
publish_message(channel, 'processing complete!')
def main():
connection, channel = connect_to_mq()
channel.basic_consume(queue='my_queue',
auto_ack=True,
on_message_callback=on_message)
channel.start_consuming()
Is there anything inherently wrong with my implementation and strategy for handling messages and workloads in separate threads that is causing this to happen?
Pika isn't thread safe by default. You should ideally keep one connection per thread.
There are a bunch of example implementation here, and I have a thread safe rpc example here that you look at as well, but I would recommend using one of their reference implementations for threading.
Inputting the code below in Visual Studio, typing "node index.js" into the Terminal Output gives me:
"WebDriverError: unknown error: 'url' must be a string"
-have tried just using driver.get(URL); and typing into the Terminal Output "Set URL=http://port-80-6p76k7hj7t.treehouse-app.com/ node index.js" which returns an error message of "A positional parameter cannot be found that accepts argument 'index.js'"
-have tried \ and // for the URL
This is the code that i'm using:
require('chromedriver');
const selenium = require('selenium-webdriver');
const By = selenium.By;
const driver = new selenium.Builder().forBrowser("chrome").build();
driver.get("https://port-80-6p76k7hj7t.treehouse-app.com/");
const locators = { inviteeForm: By.id("registrar"), inviteeNameField: By.name("name") };
function addInvitee(name) { driver.findElement(locators.inviteeNameField).sendKeys(name); driver.findElement(locators.inviteeForm).sub(); }
add invitee("Kevin Smith");
add invitee("Joe Smith");
Error i'm getting is:
[ERROR] node : C:\users\kevin.yu\selenium-basics\node_modules\selenium-webdriver\lib\promise.js:2626
[ERROR] At line:1 char:1
[ERROR] + node index.js
[ERROR] + ~~~~~~~~~~~~~
[ERROR] + CategoryInfo : NotSpecified: (C:\users\kevin....promise.js:2626:String) [], RemoteException
[ERROR] + FullyQualifiedErrorId : NativeCommandError
[ERROR]
[ERROR] throw error;
[ERROR] ^
[ERROR]
[ERROR] WebDriverError: unknown error: 'url' must be a string
[ERROR] (Session info: chrome=68.0.3440.106)
[ERROR] (Driver info: chromedriver=2.28.455520 (cc17746adff54984afff480136733114c6b3704b),platform=Windows NT 10.0.17134 x86_64)
[ERROR] at Object.checkLegacyResponse (C:\users\kevin.yu\selenium-basics\node_modules\selenium-webdriver\lib\error.js:546:15)
[ERROR] at parseHttpResponse (C:\users\kevin.yu\selenium-basics\node_modules\selenium-webdriver\lib\http.js:509:13)
[ERROR] at doSend.then.response (C:\users\kevin.yu\selenium-basics\node_modules\selenium-webdriver\lib\http.js:441:30)
[ERROR] at process._tickCallback (internal/process/next_tick.js:68:7)
[ERROR] From: Task: WebDriver.navigate().to(undefined)
[ERROR] at thenableWebDriverProxy.schedule (C:\users\kevin.yu\selenium-basics\node_modules\selenium-webdriver\lib\webdriver.js:807:17)
[ERROR] at Navigation.to (C:\users\kevin.yu\selenium-basics\node_modules\selenium-webdriver\lib\webdriver.js:1133:25)
[ERROR] at thenableWebDriverProxy.get (C:\users\kevin.yu\selenium-basics\node_modules\selenium-webdriver\lib\webdriver.js:988:28)
[ERROR] at Object.<anonymous> (C:\users\kevin.yu\selenium-basics\node_modules\index.js:12:8)
[ERROR] at Module._compile (internal/modules/cjs/loader.js:689:30)
[ERROR] at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
[ERROR] at Module.load (internal/modules/cjs/loader.js:599:32)
[ERROR] at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
[ERROR] at Function.Module._load (internal/modules/cjs/loader.js:530:3)
[ERROR] at Function.Module.runMain (internal/modules/cjs/loader.js:742:12)
[ERROR]
I am permanently stuck, please send help!
Thanks in advance!
I am unable to launch Google.. I deleted whole my workspace (I think i did a big mistake doing so) and then tried to practice selenium again but now i am even unable to launch google in it.I am using "selenium-server-standalone-3.11.0"
The Firefox driver is opening but i m unable to launch google. Can anyone help me in it.
package Basic;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.firefox.FirefoxDriver;
public class SignIn {
public static void main(String[] args) {
System.setProperty("webdriver.gecko.driver", "F:\\Selenium\\geckodriver-v0.19.1-win64\\geckodriver.exe");
WebDriver driver= new FirefoxDriver();
driver.get("https://www.google.com");
}
}
Error:-
1524588951733 Marionette INFO Listening on port 2828
[GPU 2300] WARNING: pipe error: 109: file c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[GPU 2300] WARNING: pipe error: 109: file c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Child 4276] WARNING: pipe error: 109: file c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
[Child 4276] WARNING: pipe error: 109: file c:/builds/moz2_slave/m-rel-w32-00000000000000000000/build/src/ipc/chromium/src/chrome/common/ipc_channel_win.cc, line 346
Exception in thread "main" org.openqa.selenium.WebDriverException: Process unexpectedly closed with status: 0
Build info: version: '3.11.0', revision: 'e59cfb3', time: '2018-03-11T20:33:15.31Z'
System info: host: 'RAHUL', ip: '192.168.1.109', os.name: 'Windows 8.1', os.arch: 'amd64', os.version: '6.3', java.version: '1.8.0_161'
Driver info: driver.version: FirefoxDriver
remote stacktrace: stack backtrace:
0: 0x47e934 - <no info>
1: 0x47f0a3 - <no info>
IF you are using sandbox then this will solve your problem :
setting "security.sandbox.content.level" to "5" in the Firefox profile
Else :
Update your browser.
I have a maven based mule project that was original created with mule version 3.2.1. When I update my pom.xml to change mule.version from 3.2.1 to 3.3.0, I get the following exception when running my app.
I run the app from within Eclipse by launching `org.mule.MuleServer -config src/main/app/mule-config.xml'
This worked fine with 3.2.1. If I edit my pom.xml and change mule.version back to 3.2.1 it continues to run fine. However, I really need some bug fixes that are included in 3.3.0.
Any ideas?
[07-12 16:36:01] ERROR MuleServer [main]:
********************************************************************************
Message : could not find constructor on class: interface javax.sql.DataSource, with matching arg params:
Type : org.mule.api.lifecycle.InitialisationException
Code : MULE_ERROR-71999
JavaDoc : http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/lifecycle/InitialisationException.html
Object : org.mule.config.bootstrap.SimpleRegistryBootstrap#12133926
********************************************************************************
Exception stack is:
1. could not find constructor on class: interface javax.sql.DataSource, with matching arg params: (java.lang.NoSuchMethodException)
org.mule.util.ClassUtils:408 (null)
2. could not find constructor on class: interface javax.sql.DataSource, with matching arg params: (org.mule.api.lifecycle.InitialisationException)
org.mule.config.bootstrap.SimpleRegistryBootstrap:169 (http://www.mulesoft.org/docs/site/current3/apidocs/org/mule/api/lifecycle/InitialisationException.html)
********************************************************************************
Root Exception stack trace:
java.lang.NoSuchMethodException: could not find constructor on class: interface javax.sql.DataSource, with matching arg params:
at org.mule.util.ClassUtils.instanciateClass(ClassUtils.java:408)
at org.mule.util.ClassUtils.instanciateClass(ClassUtils.java:447)
at org.mule.util.ClassUtils.instanciateClass(ClassUtils.java:419)
at org.mule.config.bootstrap.SimpleRegistryBootstrap.registerObject(SimpleRegistryBootstrap.java:325)
at org.mule.config.bootstrap.SimpleRegistryBootstrap.registerObjects(SimpleRegistryBootstrap.java:292)
at org.mule.config.bootstrap.SimpleRegistryBootstrap.initialise(SimpleRegistryBootstrap.java:165)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1536)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1477)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1409)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:574)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:89)
at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:109)
at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:116)
at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:73)
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46)
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:101)
at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:57)
at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46)
at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java:80)
at org.mule.MuleServer.initialize(MuleServer.java:375)
at org.mule.MuleServer.run(MuleServer.java:284)
at org.mule.MuleServer.start(MuleServer.java:271)
at org.mule.MuleServer.main(MuleServer.java:142)
********************************************************************************
[07-12 16:36:01] ERROR MuleServer [main]:
********************************************************************************
* A Fatal error has occurred while the server was running: *
* could not find constructor on class: interface javax.sql.DataSource, with *
* matching arg params: (java.lang.NoSuchMethodException) *
* *
* The error is fatal, the system will shutdown *
********************************************************************************
Make sure all the Mule artifacts on the classpath are version 3.3.0. It seems you have a version mismatch as line 169 of SimpleRegistryBootstrap in mule-core-3.3.0.jar is commented out.