Good morning, I would like to ask for help in a problem that I am having with the interaction between the chef-client environment and Typhoeus library. My goal in this specific cookbook is to install InfluxDB2 by the chef and the connection to the host has to be done by https. For this reason, a self-signed certificate was created by my company. To interact with the InfluxDB service, there is an API, which uses this Typhoeus library. I got a "[BUG] Segmentation fault" error and after much research I found that the problem is the interaction of this library with the chef-client, since my script to test this library works locally without any problem. Attached I send a test script for this library as well as the logs with two tests, one with my host and the other with "https://www.google.com". I ask you to try to help me in this matter. Im using last version of Chef Client.
Cheers.
Log 1 with test the host of influxdb2 "https://influxdb.host:8086" :
Log 2 with test the host "https://www.google.com":
Hi @jfreire96,
do you know if the ethon library supports Ruby 3?
We've recently upgraded Chef to use Ruby 3, Ethon might not support Ruby 3.0 out of the box yet.
I'd start there and take Chef and the bundled Gems out of the equation and just run Ethon on Ruby 3.0
Yes, I ran the script locally with ruby 3 and with the same versions of libraries and everything was working correctly, in the chef environment is that something must be working in the wrong way that I am not able to understand.
Is there any reason why the existing InfluxDB cookbook won't work for you?
I am creating my own cookbook because this cookbook is suitable for influxdb 1 and I am working on influxdb 2, this cookbook does not meet my needs for the new version of influxdb.
In order to do my own cookbook, im using influxdb-client-api for ruby. GitHub - influxdata/influxdb-client-ruby: InfluxDB 2.0 Ruby Client
I wonder, whilst we're making it support influx2 we can get a maintained version of this cookbook in the supermarket?
How are you installing the gem, are you using chef_gem?
The cookbook that is in the supermarket, I have no knowledge that it will be updated to version 2 of InfluxDB. When it comes to the cookbook I am creating, it does not seem to me because I am creating a cookbook for automation in my company and not a generic cookbook that can be adapted.
OK thanks, looks like I've replicated it in this repo
I'm going to guess it's an intersting reaction to ffi that the gem needs and the ones bundled with chef-client.
One thing; why do you need to typhoeus gem to interact with influxdb? The Gem doesn't come with typhoeus as a dep, and has other ways of interacting with influxdb
The typhoeus library is installed by the influxdb-client-apis gem. Which means that the client needs this library to function and not external ones. I will show you what happens when I install the gems locally and another case of the gems that are being installed and used by the chef.
Locally:
gem install
works for system-wide ruby whilst chef gem install
works for chef only. If this needs to be a global install you should be using the gem_package
resource rather than the chef_gem
resource.
I have also done this which I also thought could be the error but it is not. The segmentation fault problem persists. Once again, I remember that my cookbook works without problems in the chef with http and with https gives me this segmentation fault error.
Really strange. HTTPS shouldn't make any difference. I am going to see if I can duplicate the error with the code you have here.
Ok thanks, I am waiting for news.
I'm sorry I haven't had a chance to get to this. Would you be willing to send me your code via slack to take a look at?
I also apologize that I had other projects to work on, I can send the project. What is your slack contact?