Bones and mesh relationship is wrong (Bug?) I am not good with words, for that I apologize. I don't know how to explain in few words this problem.
I was working on my old personal project when I realized that it would be nice to make some changes in bone structure and rigging.. well, I have saved my old file and made a NEW armature (all bones, nice rigging, working perfectly in bone structure when I go animation mode)... but here is the problem. When I add to my mesh the armature (CTRL+P with weights and also tried without it) the mesh just gets twisted badly. Therefore I first removed all vertex groups that automatically came and added manually (also tried adding armature without weights, same problem) to make sure all is working as it should be... but, big fail. All my work got twisted in all direction.
Well, I went further, took out the bone structure (armature) deleted all my work (as i have the old backup) and made a simple tube (with plenty of subdivision for each bones) and tested it the simple way.. well.. it is the same problem. All tube is twisted badly, doesn't work as it should work. I don't know what I might have done wrong, or what is wrong with my bone structure and rigging, but... I'm a little bit upset since I have wasted 3 hours to find the solution myself. 

I don't know what is wrong with this. I'm asking the community help, perhaps corrections/tips/solutions/advice, whatever could enlighten my problem and lift up my crankiness.

I have added the file (the simple test file with the tube and the armature) so that someone who has time, take a look at it and see what is wrong with it. Why gets my mesh twisted so badly and not work in the proper way as the armature works.

Thank you all in advance, again apologize for my bad English and perhaps twisted phrases.
Your example file shows a mesh that does not match the armature in Edit Mode.



You have the choice of either building your bones inside the mesh - or - modeling your mesh around the position of the bones...



Before parenting your armature to the object it is also good practise to Apply the Scale with CTRL>A as this can also cause complications.