Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Memcached with persitent connections segfaults #27299

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

Closed
palex-fpt opened this issue May 18, 2018 · 3 comments
Closed

Memcached with persitent connections segfaults #27299

palex-fpt opened this issue May 18, 2018 · 3 comments

Comments

@palex-fpt
Copy link

palex-fpt commented May 18, 2018

Symfony version(s) affected: 4.0.0

Description
Enabling persistent connections for memcached provider, call to Memcached::createConnection starts throw segfault.

How to reproduce

public function testPersistentConnectionCreation()
	{
		/** @var \Memcached $instance */
		$instance = MemcachedCache::createConnection("memcached://localhost", ['persistent_id' => 'persistent']);
		$this->assertCount(1, $instance->getServerList());

		$instance = MemcachedCache::createConnection("memcached://localhost", ['persistent_id' => 'persistent']);
		$this->assertCount(1, $instance->getServerList()); // fail here. 

		// disabling previous assert leads to segfault due libmemcached-1.0.18 bug
		$instance = MemcachedCache::createConnection("memcached://localhost", ['persistent_id' => 'persistent']);
		$this->assertCount(1, $instance->getServerList());
	}

Possible Solution
MemcachedTrait::createConnection should not add server to lists of servers when connection is not pristine and its servers list equals to configuration list

@nicolas-grekas
Copy link
Member

would you provide a PR?
the segfault should also be reported to ext-memcache devs.

@palex-fpt
Copy link
Author

Yes, I would provide PR.
It is old known bug in libmemcached: https://bugs.launchpad.net/libmemcached/+bug/1154159

palex-fpt pushed a commit to palex-fpt/symfony that referenced this issue May 19, 2018
palex-fpt pushed a commit to palex-fpt/symfony that referenced this issue May 20, 2018
palex-fpt pushed a commit to palex-fpt/symfony that referenced this issue May 20, 2018
@palex-fpt
Copy link
Author

@nicolas-grekas I added PR to 3.3 branch. It is failed Travis CI build at unrelated components on some build configurations. Should I do something else?

palex-fpt pushed a commit to palex-fpt/symfony that referenced this issue May 29, 2018
nicolas-grekas pushed a commit to palex-fpt/symfony that referenced this issue Jun 4, 2018
nicolas-grekas added a commit that referenced this issue Jun 4, 2018
…on sequential calls (Aleksey Prilipko)

This PR was submitted for the 3.3 branch but it was merged into the 3.4 branch instead (closes #27318).

Discussion
----------

[Cache] memcache connect should not add duplicate entries on sequential calls

| Q             | A
| ------------- | ---
| Branch?       | 3.4 (be careful when merging)
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | no
| Fixed tickets | #27299
| License       | MIT

MemcachedCache::createConnection adds server to list of servers on every call. But resets this list only when it is not empty and does not match configured list.
This leads to follow: after first call list contains correct entry. After second it has server entry twice. After third it clears list and set it with correct value.

With combination of libmemcached bug (segfault on adding server after reset nonempty list) it makes impossible to use MemcachedCache::createConnection to create persistent connections.

Commits
-------

af06990 bug #27299 [Cache] memcache connect should not add duplicate entries on sequential calls
nicolas-grekas added a commit that referenced this issue Jun 6, 2018
* 3.4:
  Remove mentions of "beta" in composer.json files
  bug #27299 [Cache] memcache connect should not add duplicate entries on sequential calls
  simple-phpunit: remove outdated appveryor workaround
nicolas-grekas added a commit that referenced this issue Jun 6, 2018
* 4.0:
  Remove mentions of "beta" in composer.json files
  bug #27299 [Cache] memcache connect should not add duplicate entries on sequential calls
  simple-phpunit: remove outdated appveryor workaround
nicolas-grekas added a commit that referenced this issue Jun 6, 2018
* 4.1:
  [FrameworkBundle] Fix test-container on kernel reboot, revert to returning the real container from Client::getContainer()
  Remove mentions of "beta" in composer.json files
  [DI] Ignore missing tree root nodes on validate
  [WebProfilerBundle] fixed getSession when no session has been set deprecation warnings
  bug #27299 [Cache] memcache connect should not add duplicate entries on sequential calls
  [Router] regression when matching a route
  [FrameworkBundle][SecurityBundle] Remove no-longer necessary Bundle::registerCommands override
  [Routing] Don't reorder past variable-length placeholders
  [DebugBundle] DebugBundle::registerCommands should be noop
  [BrowserKit] Fix a BC break in Client affecting Panthère
  [DX] Improve exception message when AbstractController::getParameter fails
  simple-phpunit: remove outdated appveryor workaround
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants