async def process(self, ctx, iprot, oprot):
    args = ping_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = ping_result()
    try:
        ret = self._handler([ctx])
        if inspect.iscoroutine(ret):
            ret = (await ret)
    except TApplicationException as ex:
        async with self._lock:
            _write_application_exception(ctx, oprot, 'ping', exception=ex)
            return
    except Exception as e:
        async with self._lock:
            _write_application_exception(ctx, oprot, 'ping', ex_code=TApplicationExceptionType.INTERNAL_ERROR, message=str(e))
        raise
    async with self._lock:
        try:
            oprot.write_response_headers(ctx)
            oprot.writeMessageBegin('ping', TMessageType.REPLY, 0)
            result.write(oprot)
            oprot.writeMessageEnd()
            oprot.get_transport().flush()
        except TTransportException as e:
            if (e.type == TTransportExceptionType.REQUEST_TOO_LARGE):
                raise _write_application_exception(ctx, oprot, 'ping', ex_code=TApplicationExceptionType.RESPONSE_TOO_LARGE, message=e.message)
            else:
                raise e
async def process(self, ctx, iprot, oprot):
    args = ping_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = ping_result()
    try:
        ret = self._handler([ctx])
        if inspect.iscoroutine(ret):
            ret = (await ret)
    except TApplicationException as ex:
        async with self._lock:
            _write_application_exception(ctx, oprot, 'ping', exception=ex)
            return
    except Exception as e:
        async with self._lock:
            _write_application_exception(ctx, oprot, 'ping', ex_code=TApplicationExceptionType.INTERNAL_ERROR, message=str(e))
        raise
    async with self._lock:
        try:
            oprot.write_response_headers(ctx)
            oprot.writeMessageBegin('ping', TMessageType.REPLY, 0)
            result.write(oprot)
            oprot.writeMessageEnd()
            oprot.get_transport().flush()
        except TTransportException as e:
            if (e.type == TTransportExceptionType.REQUEST_TOO_LARGE):
                raise _write_application_exception(ctx, oprot, 'ping', ex_code=TApplicationExceptionType.RESPONSE_TOO_LARGE, message=e.message)
            else:
                raise e