Giter Club home page Giter Club logo

pjrpc's Introduction

ℹ️ About Me:

Software engineer with more than six years of experience working on projects from different fields like cybersecurity, cloud computing, financial services; looking to become a part of an experienced developer team to work on creating innovative software and services.

Projects:

Python pydantic-xml PyPI - Downloads
Python generic-connection-pool PyPI - Downloads
Python pjrpc PyPI - Downloads
Python crontools PyPI - Downloads
Python aiohttp-validator PyPI - Downloads
Rust ext-sort Crates.io - Downloads

🛠️ Languages and Tools:

Rust  Python  C  C++  Linux  Postgresql  Rabbitmq  Redis 

CV:

🇬🇧    🇷🇺   

Contacts:

telegram    email    linkedin   

pjrpc's People

Contributors

bernhardkaindl avatar dapper91 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

Watchers

 avatar  avatar  avatar

pjrpc's Issues

[email protected]: Exception from close() after connect()

import asyncio

from pjrpc.client.backend import aio_pika as pjrpc_client


async def main():
    client = pjrpc_client.Client('amqp://guest:guest@localhost:5672/v1', 'jsonrpc')
    await client.connect()
    await client.close()


if __name__ == "__main__":
    asyncio.run(main())

with 1.6.0, this results in:

  File "aio_pika_client-close-test.py", line 9, in main
    await client.close()
  File "/home/autonoma/flowhub/pjrpc/pjrpc/client/backend/aio_pika.py", line 86, in close
    assert self._result_queue is not None, "client is not initialized"
AssertionError: client is not initialized

self._result_queue is always none, unless the Client is costructed to use a fixed result_queue like this:

    kwargs["result_queue_name"] = "jsonrpc-responses"
    kwargs["result_queue_args"] = {
        "exclusive": False,
        "auto_delete": False,
        "durable": True,
        "arguments": None,
    }
    client = xjsonrpc_client.Client(
        URL("amqp://guest:guest@localhost:5672/"),
        "jsonrpc-requests",
        **kwargs,
    )

But for the majority of uses, a fixed result queue is not needed and a temporary result queue is used for each call (which is easier if you want to run more than one RPC client)

pjrpc incorrectly serves openapi-swagger-ui bundle

When using the latest python-openapi-us-bundle for Swagger, the UI always shows Petstore OpenAPI instead of the API defined by the app.

The reason is rather simple - in

pattern=r'SwaggerUIBundle\({.*?}\)',
the index.html is patched, and it is expected that SwaggerUIBundle initialization is embedded into it. However, the index.html in the latest bundle version does not have this code embedded anymore. Instead, it is laid out into swagger-initialization.js, see https://github.com/dapper91/python-openapi-ui-bundles/blob/master/openapi_ui_bundles/swagger_ui/vendor/index.html

Sudden hang when examples/kombu_server.py and kombu_client.py communicate.

When examples/kombu_server.py and kombu_client.py communicate, the communication suddenly stops:

while true;do python examples/kombu_client.py;echo;sleep 1;done

After a few iterations of the loop, the client no longer prints the output of the sum(1,2) RPC calls.

DEBUG:amqp:Start from server, version: 0.9, properties: {'capabilities': {'publisher_confirms': True, 'exchange_exchange_bindings': True, 'basic.nack': True, 'consumer_cancel_notify': True, 'connection.blocked': True, 'consumer_priorities': True, 'authentication_failure_close': True, 'per_consumer_qos': True, 'direct_reply_to': True}, 'cluster_name': 'rabbit@sf314', 'copyright': 'Copyright (c) 2007-2022 VMware, Inc. or its affiliates.', 'information': 'Licensed under the MPL 2.0. Website: https://rabbitmq.com', 'platform': 'Erlang/OTP 24.2.2', 'product': 'RabbitMQ', 'version': '3.9.13'}, mechanisms: [b'AMQPLAIN', b'PLAIN'], locales: ['en_US']
DEBUG:amqp:using channel_id: 1
DEBUG:amqp:Channel open
1 + 2 = 3

I see in the rabbitmq log that server and client stay connected, but the client does not continue sending requests:

In the kombu_server log, I see that the server sends the response for the sum method, but the client does not have any logger calls about sending requests or receiving responses.

This is with a kombu_client.py which requests one sum(1,2) and sends one tick(). The tick after the sum is not received:

DEBUG:pjrpc.server.request:request received: {"jsonrpc": "2.0", "method": "sum", "id": 1, "params": [1, 2]}
DEBUG:pjrpc.server.response:response sent: {"jsonrpc": "2.0", "id": 1, "result": 3}
DEBUG:pjrpc.server.request:request received: {"jsonrpc": "2.0", "method": "tick"}
received tick
DEBUG:pjrpc.server.request:request received: {"jsonrpc": "2.0", "method": "sum", "id": 1, "params": [1, 2]}
DEBUG:pjrpc.server.response:response sent: {"jsonrpc": "2.0", "id": 1, "result": 3}
DEBUG:amqp.connection.Connection.heartbeat_tick:heartbeat_tick : for connection 658eb70988e8400d9bdfb55a26b12b35
DEBUG:amqp.connection.Connection.heartbeat_tick:heartbeat_tick : for connection 658eb70988e8400d9bdfb55a26b12b35
DEBUG:amqp.connection.Connection.heartbeat_tick:heartbeat_tick : for connection 658eb70988e8400d9bdfb55a26b12b35

The server still receives heartbeats and and answers to other clients.

Just a suggestion / hint for diagnosis: I think logging of requests and responses shoud be added to the kombu client to aid in tracing,
and

logging.basicConfig(level=logging.DEBUG)

should be added to server and client: For kombu, the even the debug logging is not too verbose.

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.