Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swoole\Redis\Server::format(Server::string, "xxxxx") cannot be used independently #3368

Closed
zqe opened this issue Jun 5, 2020 · 1 comment · Fixed by #3369
Closed

Swoole\Redis\Server::format(Server::string, "xxxxx") cannot be used independently #3368

zqe opened this issue Jun 5, 2020 · 1 comment · Fixed by #3369

Comments

@zqe
Copy link

zqe commented Jun 5, 2020

Please answer these questions before submitting your issue. Thanks!

  1. What did you do? If possible, provide a simple script for reproducing the error.
<?php

declare(strict_types=1);

use Swoole\Server;
use Swoole\Redis\Server as RedisServer;
$server = new Server("0.0.0.0",8000);


$port = $server->addlistener('0.0.0.0',6379);


$port->on('receive',function($server, $fd, $rid, $data) {
	$server->send($fd,RedisServer::format(RedisServer::STRING,"1234"));
});

$server->start();
[2020-06-05 01:20:10 $4663.0]	WARNING	swManager_check_exit_status: worker#0[pid=4665] abnormal exit, status=0, signal=11
A bug occurred in Swoole-v4.5.0, please report it.
The Swoole developers probably don't know about it,
and unless you report it, chances are it won't be fixed.
You can read How to report a bug doc before submitting any bug reports:
>> https://github.com/swoole/swoole-src/blob/master/.github/ISSUE.md
Please do not send bug reports in the mailing list or personal letters.

I need to implement a custom redis server service on 'swoole \ server \ port'

In the response encapsulation step, you want to borrow the 'swoole \ redis \ server:: format' method

A segment error will occur, causing the whole swoole process to be interrupted

  1. What did you expect to see?
Server::format(Server::STRING,"111")

I hope that 'server:: format' can work independently when called as a static method

By viewing swoole_ redis_ server.cc Find the format that depends on in the foramt function_ This problem is caused by buffer initialization in the 'swoole \ redis \ server:: start' startup phase

  1. What version of Swoole are you using (show your php --ri swoole)?

swoole

Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 4.5.0
Built => May  7 2020 14:04:04
coroutine => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
cpu_affinity => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 1.0.2k-fips  26 Jan 2017
http2 => enabled
pcre => enabled
zlib => 1.2.7
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => Off => Off
swoole.unixsock_buffer_size => 8388608 => 8388608
@twose twose added the bug label Jun 5, 2020
@twose twose changed the title Swoole \ redis \ server:: format (server:: string, "xxxxx") cannot be used independently Swoole\Redis\Server::format(Server::string, "xxxxx") cannot be used independently Jun 5, 2020
@twose
Copy link
Member

twose commented Jun 5, 2020

[Robot]: Thank you for your BUG feedback. Please quickly confirm the following points to help us locate your problem:

  1. If you upgraded manually instead of compiling for the first time, make sure you run make clean before compiling to clean up the contents of the last compilation

  2. If you are using a Linux, use the following command to run your program, operate your program in a way that can reproduce the bug, and show the content of valgrind.log in the /tmp dir after the program runs for a certain time

USE_ZEND_ALLOC=0 valgrind --log-file=/tmp/valgrind.log php xxx.php
  1. If you are using macOS, you will not be able to use valgrind, please provide PHP code that can reproduce the bugs

@matyhtf matyhtf mentioned this issue Jun 5, 2020
twose added a commit that referenced this issue Jun 5, 2020
* fix #3367

* Fix typo

Co-authored-by: twosee <twose@qq.com>
@twose twose added the fixed label Jun 5, 2020
Yurunsoft pushed a commit to Yurunsoft/swoole-src that referenced this issue Aug 31, 2020
* fix swoole#3367

* Fix typo

Co-authored-by: twosee <twose@qq.com>
matyhtf added a commit that referenced this issue Sep 1, 2020
* Fix #3362 (#3365)

* Fix #3368 (#3369)

* fix #3367

* Fix typo

Co-authored-by: twosee <twose@qq.com>

* Fix swoole_get_local_mac on OSX (#3372)

# Conflicts:
#	swoole.cc

* fix mysql test case (#3374)

* fix: stop worker in workerStart (#3382)

* fix: stop worker in workerStart

* improvement: add newline at end of file

* Fix missing MySQL transaction error, update the test (#3429)

* fix http client download filename bug (#3489)

* fix http client download filename bug

* fix zend::String()->release()

* Fix #3532 (#3534)

* fix #3532

* improve getHeaderOut()

* add tests
# Conflicts:
#	include/coroutine_socket.h
#	swoole_http_client_coro.cc

* Fixed: fix header inject when use CRLF (#3539)

* fix: fix header inject when use CRLF

* test: add test
# Conflicts:
#	swoole_http_response.cc

* Fixed: Fix  CRLF injection in `redirect` and `header` (#3541)

* Fix CRLF injection in `redirect` and `header`

The previous fix (#3539) was incomplete.
The added check is not enforced when `ucwords` is set to false.

* Fix typo
# Conflicts:
#	swoole_http_response.cc

* Fixed: check cookie injection (#3545)

* Fixed: check cookie injection

* fix: don't check crlf when use cookie urlencode
# Conflicts:
#	swoole_http_response.cc

* Fixed: set coroutine websocket server frame->fd (#3549)

* Fixed: set coroutine websocket server frame->fd

* fix: fix test

* Fix #3577 (#3579)

# Conflicts:
#	swoole_runtime.cc

* Fix the test (#3430)

# Conflicts:
#	tests/swoole_http2_client_coro/post.phpt

* test: fix swoole_http_client_coro/upload_big.phpt (#3590)

* fix: fix http client upload_big test

* fix: http client upload big file

* Fix test

* Fix free

* Fix free

Co-authored-by: twosee <twose@qq.com>
Co-authored-by: 韩天峰-Rango <mikan.tenny@gmail.com>
Co-authored-by: 耐小心 <qiqizjl@qq.com>
Co-authored-by: codinghuang <2812240764@qq.com>
Co-authored-by: Jiantao Li <CurseRed@Gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants