[MB-6395] memcachedprocess does not start on windows 8/ windows 2012 Created: 22/Aug/12  Updated: 28/May/13  Resolved: 08/May/13

Status: Closed
Project: Couchbase Server
Component/s: couchbase-bucket
Affects Version/s: 2.0, 2.0.1, 2.1.0
Fix Version/s: 2.1.0
Security Level: Public

Type: Bug Priority: Critical
Reporter: Farshid Ghods (Inactive) Assignee: Thuan Nguyen
Resolution: Fixed Votes: 3
Labels: 2.0-release-notes, windows
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File 0001-issue-511-implemented-rel8-jump-patching.patch     Text File 0002-issue-511-recognise-rex.w-jmpq-literal-rip-as-iat-ju.patch     File libtcmalloc_minimal-4.dll     Zip Archive ns-diag-20120824144333.zip    
Issue Links:
is duplicated by MB-7016 Server permanently down in Win 8 / Se... Closed

reported by a user . dont have logs yet.

Comment by Peter Wansch (Inactive) [ 23/Aug/12 ]
This is a post 2.0 requirement.
Comment by Farshid Ghods (Inactive) [ 24/Aug/12 ]
Port server memcached on node 'ns_1@' exited with status 255. Restarting. Messages: Check failed: false && "Unable to patch because there is an unhandled branch " "instruction in the initial preamble bytes.": false && "Unable to patch because there is an unhandled branch " "instruction in the initial preamble bytes."

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.
Comment by Farshid Ghods (Inactive) [ 24/Aug/12 ]
there is also some minor issue in the UI logs

'ns_1@' in 0.26s
 supervisor_cushion001 ns_1@ 14:20:35 - Fri Aug 24, 2012
 Client-side error-report for user "Administrator" on node 'ns_1@':
User-Agent:Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)
Got unhandled error: Object doesn't support this action
At: http://localhost:8091/js/cells.js:64
Function: collectBacktraceViaCaller

Function: appOnError
"Object doesn't support this action"
Function: (function () {throw e;})

Comment by Karan Kumar (Inactive) [ 24/Aug/12 ]
We would nede the browser logs attached here.
Comment by Chris Wundram [ 10/Oct/12 ]
I managed to work around this. The problem was with the tcmalloc library. I replaced libtcmalloc_minimal-4.dll with a new dll with the same __tcmalloc export, and that resolved the issue.
Comment by Orfeas Zafeiris [ 22/Oct/12 ]
For anyone interested this is a x64 version of a 'wrapper' for libtcmalloc.
Just place it in your couchbase 'bin' directory and restart the couchbase service.

If anyone wants the x86 version feel free to ask.


PS: Thanks to Chris Wundram for the hint!
Comment by Farshid Ghods (Inactive) [ 06/Nov/12 ]
assinging this to myself so that as documentation for now so that we upload this file after getting permission from the owner and share this with users
Comment by Chad Kreimendahl [ 14/Nov/12 ]

Comment by Bill Robertson [ 28/Nov/12 ]
Thanks Orfeas. I pulled the wrapper and replaced the dll in my folder and don't have the same constant failure errors. Windows 8 Pro 64bit.
Comment by Michael Elson [ 07/Dec/12 ]
I'm troubleshooting a similar problem. I wrote code that runs fine on win7 64x but when I run on win8 64x I get this error "bucket count must be a power of 2!". where do I get this tcmalloc dll file? and where do I put in on my machine? maybe I missing something, but the above posts say this could be a fix for win8 issues, but for the tcmallow NOOB I have no idea what to do. can you please share the basic info?
Comment by Michael Elson [ 07/Dec/12 ]
please allow me to quickly answer my own post here...

the 64x file to download is here: http://www.mediafire.com/?xc8nurnxjqr8klb

the file goes here: Just place it in your couchbase 'bin' directory and restart the couchbase service.

I read too quickly in my hasty approach to continue coding. :-)
Comment by ldsenow [ 20/Dec/12 ]
Replace the libtcmalloc_minimal-4.dll worked for me in 2.0 beta version on Windows 8
after I have installed the 2.0 release version(tried both EE and CE), this trick does not make any difference. Now the service is started but I cant access to the Web console.
Any idea why or work around?
Comment by kzeller [ 27/Mar/13 ]
removing documentation as component until we know confirm something should be documented....
Comment by Chad Kreimendahl [ 27/Mar/13 ]
The title of this bug needs to change to be "memcached does not start on Windows Server 2012 and Windows 8 because of bad tcmalloc binary". I don't believe the proper attention is being given to this issue, given that people running a released version of a windows server have to perform a workaround. The fix is unbelievably simple and still works on 2008r2, etc.
Comment by Sriram Melkote [ 28/Mar/13 ]
Windows 2012 is not yet supported, and so there's no proper binary.
However, Windows 2012 support is a priority item for upcoming 2.0.2 release.
I'll also link an early build here as soon as it is available in the next few weeks.
Comment by Maria McDuff (Inactive) [ 01/Apr/13 ]
per bug scrub: we'll continue to track win2012 for 2.0.2 release until the code freeze date but won't be a blocker for shipping 2.0.2. windows 8, however, will be a blocker though for the 2.0.2 release.
Comment by Maria McDuff (Inactive) [ 16/Apr/13 ]
siri still working on this.
Comment by Sriram Melkote [ 23/Apr/13 ]
Yes, definitely for 2.0.2 -- Win 2012 and Win 8. Production worthiness depends on how much testing QE does.
Comment by Maria McDuff (Inactive) [ 29/Apr/13 ]
per bug mtg, we will not be supporting win8/win2012 for 2.0.2.
deferring to 2.1.
Comment by Aleksey Kondratenko [ 06/May/13 ]
Nailed. Expect tcmalloc patches attached here soon
Comment by Aleksey Kondratenko [ 06/May/13 ]
tcmalloc patches above are fixing this issue. They are rebased against our fork of tcmalloc.
Comment by Aleksey Kondratenko [ 06/May/13 ]
Folks who need working dll right now can grab libtcmalloc_minimal-4.dll that's attached. It's x86-64 .dll that's built from upstream tcmalloc with earlier versions of attached patches applied.
Comment by Aleksey Kondratenko [ 06/May/13 ]
Unaware that we've decide to move this out of 2.0.2 I spent some time on Friday and today and I believe fix this issue.

Please allow this for 2.0.2.

In case of positive decision I'd like this reassigned to Bin because he handles our fork of tcmalloc. So that he can grab my patches, apply and push to our repository.
Comment by Aleksey Kondratenko [ 07/May/13 ]
Assigned back to Maria in case assignment to Mike is some accident.

In case you really wanted to assign to Mike, please explain why. I see no reason for this.
Comment by Mike Wiederhold [ 07/May/13 ]

Maria and Yassen just want me to look at the changes you have and if all looks good I would assign this to bin to get the changes merged into the 2.0.2 code base. Please add me to review when you have a chance.
Comment by Mike Wiederhold [ 07/May/13 ]
I just reviewed Alk's changes. They require specific knowledge of visual studio and how code is compiled on windows. They look ok to me, but I lack context in that area so I'm not the best person to ask. Alk seems to have run all of the tests too so I think it makes sense to move forward with more extensive testing.
Comment by Aleksey Kondratenko [ 07/May/13 ]
This stuff is merged upstream now btw
Comment by Mike Wiederhold [ 07/May/13 ]

Please merge the following 2 changes from 3/7 which are on alk's github.

Comment by Aleksey Kondratenko [ 07/May/13 ]
No best place is to grab them from attachments here. Attachments are specifically rebased on top of our version of tcmalloc
Comment by Bin Cui [ 08/May/13 ]
It is merged to couchbase/gperftools

commit 44a584d1de8c89addfb4f1d0522bdbbbed83ba48
Author: Aliaksey Kandratsenka <alkondratenko@gmail.com>
Date: Tue May 7 17:22:42 2013 -0700

    issue-511: implemented rel8 jump patching

    I've found that Visual Studio 2012 release 32-bit C runtime library
    patching fails because array new has rel8 jmp which previous code
    could not handle.

    Implementation is largely copied from conditional jumps handling code.

    Apparently Windows Server 2012 (and presumably windows 8) now has this
    form of iat jump. Which is quite useless (rex.w in according to my
    understanding is not needed at all) but because of rex.w our code to
    recognize jumps like that didn't work.

    Fix is just skip this prefix.
Comment by Anil Kumar [ 09/May/13 ]
maria, can you assign this bug to QE who is going to test this.
Comment by Maria McDuff (Inactive) [ 13/May/13 ]
Tony, pls verify / close in win8/2k12.
Comment by Thuan Nguyen [ 28/May/13 ]
Tested on build 2.0.2-811, memcached process runs ok after installation
Generated at Thu Nov 20 16:57:14 CST 2014 using JIRA 5.2.4#845-sha1:c9f4cc41abe72fb236945343a1f485c2c844dac9.