#community-help

Trouble Running Typesense Docker Image on AMD Phenom II X4 955 Processor

TLDR Ian struggles to run Typesense on an AMD Phenom II X4 955 Processor, experiencing the docker image to shut down immediately upon startup. Jason and Kishore Nallan suggest multiple troubleshooting steps, identifying the potential issue as the processor's lack of support for MSSE4 flags.

Powered by Struct AI

1

Oct 17, 2022 (14 months ago)
Ian
Photo of md5-570c9110eca6a274b9a81eece83ee2dc
Ian
09:47 PM
Hi, I'm just trying out typesense but can't seem to get the docker image to work. Usually I use docker-compose so maybe I'm doing something wrong but it just starts up and then shuts down. Do I need to preload the data directory with information before I start the server ?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
09:48 PM
Could you share the logs from the typesense container?
09:48
Jason
09:48 PM
You do need to mount a directory from the host and pass that into the container to use as the data dir
Ian
Photo of md5-570c9110eca6a274b9a81eece83ee2dc
Ian
09:53 PM
$ sudo rm -Rf /tmp/typesense_data
$ mkdir /tmp/typesense_data; docker run -p8108:8108 -v/tmp/typesense_data:/data typesense/typesense:0.23.1 --data-dir /data --api-key=anything --enable-cors
$ docker ps -l
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
91cfa8a0e989 typesense/typesense:0.23.1 "/opt/typesense-serv…" 8 seconds ago Exited (132) 6 seconds ago pensive_mendeleev
$ docker logs 91cfa8a0e989
$
09:54
Ian
09:54 PM
Do you know what code 132 is ?
09:54
Ian
09:54 PM
Maybe I'm using the port or something.
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
09:55 PM
Is your host machine ARM by any chance?
Ian
Photo of md5-570c9110eca6a274b9a81eece83ee2dc
Ian
09:55 PM
AMD Phenom(tm) II X4 955 Processor
09:56
Ian
09:56 PM
The logs appear completely empty.
09:56
Ian
09:56 PM
Is there an older version I should try ?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
09:57 PM
Could you try adding --platform=linux/amd64 to the docker run command?
09:57
Jason
09:57 PM
I suspect Docker is somehow pulling the image for the wrong CPU arch, so it’s not even booting up for the Typesense binary to run
Ian
Photo of md5-570c9110eca6a274b9a81eece83ee2dc
Ian
10:05 PM
Doesn't seem to change outcome.
10:08
Ian
10:08 PM
Is there an older version I could try ?
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
10:10 PM
It looks like AMD Phenom(tm) II X4 955 Processor was first released in 2009. Code 132 essentially means there was a CPU instruction that was sent that the CPU didn’t understand. So I suspect your processor’s instruction set doesn’t support the docker image.

We only started publishing Docker images in 2018, so I don’t think older versions of the Typesense docker image would work either…

Your best bet would be to rebuild the docker image on your host machine
Ian
Photo of md5-570c9110eca6a274b9a81eece83ee2dc
Ian
10:10 PM
I deleted that image but it says I downloaded it 3 months ago, probably last time I tried it. Seems weird it would be broken that long and no one else would notice. Seems like some conflict with my setup maybe. I'm going to try to restart.
10:11
Ian
10:11 PM
Okay I'll maybe try that next or try running it on another machine.
10:11
Ian
10:11 PM
Thanks for your help, bbl.

1

Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
10:12 PM
If you need to build the Docker image, here’s a one-liner: https://github.com/typesense/typesense#build-from-source
Ian
Photo of md5-570c9110eca6a274b9a81eece83ee2dc
Ian
11:16 PM
Still 132, maybe I didn't build it correctly.
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
11:17 PM
Once you’ve built it, you want to use typesense/typesense:nightly as the image name in your docker run command
11:19
Jason
11:19 PM
Oh wait, just remembered that the build relies on another docker image that also needs to be rebuilt: https://github.com/typesense/typesense/blob/a1a77242b68d9bd0d6ca34eba3dfa9e4b542c444/docker-build.sh#L32
11:20
Jason
11:20 PM
So you want to rebuild this docker image: https://github.com/typesense/typesense/blob/main/docker/development.Dockerfile

And then use that development image in docker-build.sh instead
Ian
Photo of md5-570c9110eca6a274b9a81eece83ee2dc
Ian
11:20 PM
The script didn't actually finish I had to try to make it work at the end.
11:21
Ian
11:21 PM
Okay, that file is different, let me see if I can get it to work.
11:23
Ian
11:23 PM
In the original script this line fails because the permissions are root and non-root:
cp $PROJECT_DIR/docker/deployment.Dockerfile $PROJECT_DIR/$BUILD_DIR
Oct 18, 2022 (14 months ago)
Ian
Photo of md5-570c9110eca6a274b9a81eece83ee2dc
Ian
12:51 AM
$ docker image ls | grep typesense
typesense/typesense               nightly                          b6ffb22b8f1c   6 minutes ago    822MB
typesense/typesense-development   nightly                          e960b42ed3e4   17 minutes ago   5.17GB
12:51
Ian
12:51 AM
$ git diff --cached
diff --git a/docker-build.sh b/docker-build.sh
index 059afaa..e69e84b 100755
--- a/docker-build.sh
+++ b/docker-build.sh
@@ -29,7 +29,7 @@ if [[ "$@" == *"--depclean"* ]]; then
 fi
 
 
-TYPESENSE_DEV_IMAGE="typesense-development:27-JUN-2022-1"
+TYPESENSE_DEV_IMAGE="typesense-development:nightly"
 ARCH_NAME="amd64"
 
 if [[ "$@" == *"--graviton2"* ]]; then
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
12:52 AM
Yeah that should be changes needed… Did this nightly image work when you use it with docker run?
Ian
Photo of md5-570c9110eca6a274b9a81eece83ee2dc
Ian
12:53 AM
No seems to be same problem.
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
12:53 AM
😞
Ian
Photo of md5-570c9110eca6a274b9a81eece83ee2dc
Ian
12:53 AM
O
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
12:53 AM
Kishore Nallan Any thoughts here?
Ian
Photo of md5-570c9110eca6a274b9a81eece83ee2dc
Ian
12:53 AM
I'm suspicious that some cruft is left in that long set of steps.
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
12:54 AM
Just to confirm, the compilation process finished successfully without any errors yeah?
Ian
Photo of md5-570c9110eca6a274b9a81eece83ee2dc
Ian
12:54 AM
TYPESENSE_VERSION=nightly ./docker-build.sh --build-deploy-image --create-binary --clean
Jason
Photo of md5-8813087cccc512313602b6d9f9ece19f
Jason
12:54 AM
What were the last few lines of the output of that command?
Ian
Photo of md5-570c9110eca6a274b9a81eece83ee2dc
Ian
12:55 AM
Creating deployment image for Typesense nightly server ...
+ cp /home/ian/workspace/laspilitas-project/typesense/docker/deployment.Dockerfile /home/ian/workspace/laspilitas-project/typesense/build-Linux
+ docker build --file /home/ian/workspace/laspilitas-project/typesense/build-Linux/deployment.Dockerfile --tag typesense/typesense:nightly /home/ian/workspace/laspilitas-project/typesense/build-Linux
Sending build context to Docker daemon  435.4MB
Step 1/7 : FROM ubuntu:16.04
 ---> b6f507652425
Step 2/7 : RUN apt-get -y update && apt-get -y install ca-certificates
 ---> Using cache
 ---> fcdd8e825033
Step 3/7 : RUN mkdir -p /opt
 ---> Using cache
 ---> 4f5e1feca84b
Step 4/7 : COPY typesense-server /opt
 ---> e35dad4a35cd
Step 5/7 : RUN chmod +x /opt/typesense-server
 ---> Running in b6e9a1f0d73e
Removing intermediate container b6e9a1f0d73e
 ---> 2d20f833c3f6
Step 6/7 : EXPOSE 8108
 ---> Running in 4819a975c579
Removing intermediate container 4819a975c579
 ---> 07f38aafca69
Step 7/7 : ENTRYPOINT ["/opt/typesense-server"]
 ---> Running in fd683bf4b494
Removing intermediate container fd683bf4b494
 ---> b6ffb22b8f1c
Successfully built b6ffb22b8f1c
Successfully tagged typesense/typesense:nightly
+ [[ --build-deploy-image --create-binary --clean == *\-\-\p\a\c\k\a\g\e\-\b\i\n\a\r\y* ]]
+ echo 'Done... quitting.'
Done... quitting.

12:57
Ian
12:57 AM
I feel this has something to do with my debian setup for some reason. Someone else would have run into this. I'm assuming a lot of other people are using amd64.
12:58
Ian
12:58 AM
I used this to build the image docker build --file docker/development.Dockerfile --tag typesense-development:nightly docker
12:58
Ian
12:58 AM
I had to retag it because I didn't include the typesense prefix but that seemed to work fine.
12:59
Ian
12:59 AM
$ docker image ls | grep typesense
typesense/typesense               nightly                          b6ffb22b8f1c   14 minutes ago   822MB
typesense-development             nightly                          e960b42ed3e4   26 minutes ago   5.17GB
typesense/typesense-development   nightly                          e960b42ed3e4   26 minutes ago   5.17GB
01:00
Ian
01:00 AM
I'm going to start from the beginning and try ignoring the cache.
01:03
Ian
01:03 AM
If that doesn't work I'll make an issue and someone will either spot my mistake or suggest a work around.
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
01:39 AM
Can you try running the binary via GDB to check where it crashes?
Ian
Photo of md5-570c9110eca6a274b9a81eece83ee2dc
Ian
02:19 AM
docker run -p8108:8108 -v/tmp/typesense_data:/data typesense/typesense:nightly gdb /opt/typesense-server --data-dir /data --api-key=anything
02:20
Ian
02:20 AM
I guess I'm not sure how to do this via docker, should that work ?
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
04:28 AM
Since the Docker container will build the binary locally first and then only copy into the image, you can launch any Ubuntu container with the directory containing the executable as a mounted volume, install gdb and then run it inside.
Ian
Photo of md5-570c9110eca6a274b9a81eece83ee2dc
Ian
07:40 PM
I just use the typesense-server from build-Linux directory in Ubuntu
root@124a97b7c5a0:/build-Linux# TYPESENSE_DATA_DIR=/data TYPESENSE_API_KEY=anything gdb --args typesense-server 
GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.5) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from typesense-server...done.
(gdb) run
Starting program: /build-Linux/typesense-server 
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7f228a47f700 (LWP 552)]

Thread 2 "typesense-serve" received signal SIGILL, Illegal instruction.
[Switching to Thread 0x7f228a47f700 (LWP 552)]
0x0000000000780305 in bvar::detail::PercentileSamples<1022ul>::get_number (this=0x7f2289426140, ratio=<optimized out>) at /usr/local/include/bvar/detail/percentile.h:293
293    /usr/local/include/bvar/detail/percentile.h: No such file or directory.
(gdb)
08:03
Ian
08:03 PM
0x780305 <bvar::detail::PercentileSamples<1022ul>::get_number(double)+37>       roundsd $0xa,%xmm0,%xmm0
08:33
Ian
08:33 PM
I guess my cpu only supports &lt;=SSE4a. Is it possible to spec that somewhere during compilation ?
Oct 20, 2022 (14 months ago)
Kishore Nallan
Photo of md5-4e872368b2b2668460205b409e95c2ea
Kishore Nallan
04:40 AM
I've replied to your Github issue. I think if Braft's msse4 flags are removed, it should work.

Typesense

Lightning-fast, open source search engine for everyone | Knowledge Base powered by Struct.AI

Indexed 3015 threads (79% resolved)

Join Our Community

Similar Threads

Trouble with DocSearch Scraper and Pipenv Across Multiple OSs

James ran into errors when trying to build Typesense DocSearch Scraper from scratch, and believes it’s because of a bad Pipfile.lock. Jason attempted to replicate the error, and spent hours trying to isolate the issue but ultimately fixed the problem and copied his bash history for future reference. The conversation touches briefly on the subject of using a virtual machine for testing.

7

161
10mo

Troubleshooting Typesense Docsearch Scraper Setup Issue

Vinicius experienced issues setting up typesense-docsearch-scraper locally. Jason identified a misconfiguration with the Typesense server after checking the .env file, and recommended using ngrok or port forwarding for development purposes. Vinicius successfully resolved the issue with port forwarding.

2

12
5mo

Resolving Connection Issues on Ubuntu 21.10

Philipe faced a problem with TypeSense running on Ubuntu 21.10. After troubleshooting, Jason and Kishore Nallan suggested a binary to solve the compatibility issue, which resolved the issue.

4

38
25mo

Resolving Issues with Infix and Prefix in Query Searches

Daren struggled with searches missing values in production. Jason and Kishore Nallan offered insights and created new features to help solve the problem, which was then tested and deployed by Daren.

2

38
5mo

Troubleshooting Typesense Server Error on Docker

vikram was facing an error with Typesense Server Docker container and loss of data on restart. Kishore Nallan guided to avoid mounting tmp directory from localhost and explained stopping the Docker container.

2

16
14mo