Skip to content
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

Cobrazz improvements #316

Open
wants to merge 9 commits into
base: develop
Choose a base branch
from

Conversation

yoori
Copy link

@yoori yoori commented Jun 27, 2023

Improvements:

  1. added function RunEmbedded for run components and stop outside without signal ... (author @anton3332), now stop by mutex.unlock
  2. added ability to build shared libraries variant (for use in rpm build)
  3. ability to build with gdb debug info (USERVER_GEN_GDB_DEBUGINFO - disabled by default) - this allow to see more informative stacks on linux with using debugsource package.
  4. added cmake install of project (for use in rpm build or conan build)
  5. added environment for build rpm on epel8 linux's (script, scripts for build dep fresh packages and spec file)

Fixes:

  1. fix of building inside folder sym linked to other place - in this case "protoc" require that include base is prefix of proto file,
    for fix - we resolve paths to real paths before protoc execute

Specific changes:

  1. we decreased protobuf, grpcio python package dependency versions (requirements*.txt) for use standard python packages installed through rpm's.
    Otherwise we have strange requirement: should be installed latest version of these packages by pip, independent on versions of c++ packages

All these changes we tested : we link userver preinstalled on host as rpm package, and runned http, grpc components in production

PATTERN "*.h"
)

install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/utils/signal_catcher.hpp"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy-pasta: we shouldn't need to edit CMake scripts when adding new source files

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This part install private file that we need to include after installation (from src/ folder, userver_add_library install only include folder)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stuff in src/ and impl is private API. We provide no support for code that uses such workarounds to access it anyway. If you still need it, move it to public API (include). Please expand on why you need it, we'll figure out the best way to expose the necessary tools.

}
};

void DoRun(std::mutex& stop_mutex,
Copy link
Member

@Anton3 Anton3 Jun 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why copy-paste components::Run? Please expand on why stop_mutex is needed

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Run can be stopped only from components (usually by signal handling), we need to have ability stop it from code (here mutex unlock initiate components destruction and stopping as result)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

std::raise(SIGINT)?

@@ -0,0 +1,54 @@
#include <utils/userver_experiment.hpp>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An extra file as a rebase artifact?

@@ -0,0 +1,26 @@
#pragma once
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An extra file as a rebase artifact?


userver_export(TARGETS ${PROJECT_NAME}-deps)

install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/src/ugrpc/client/impl/client_configs.hpp"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why?

@@ -1 +1 @@
protobuf>=4.21.12
protobuf>=3.21.9
Copy link
Member

@Anton3 Anton3 Jun 30, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changing these versions will break gRPC tests for someone again :)
We've only just found a good combination that satisfies most users

Protobuf has broken backwards compatibility around version 3.21 (which is, confusingly, also called 4.21): old Python packages must be used with older system protoc, and new Python packages must be used with newer system protoc versions.

We now support two build modes for gRPC. If we detect an old enough system protobuf, we use scripts/grpc/requirements-old.txt instead of scripts/grpc/requirements.txt. Same for testsuite/requirements-grpc.txt and testsuite/requirements-grpc-old.txt.

@@ -140,4 +170,8 @@ else ()
add_definitions(-D_FORTIFY_SOURCE=2)
endif ()

if (UNIX AND BUILD_SHARED_LIBS)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do not support building userver as a dynamic library. Doing so will result in performance drops (we rely on LTO heavily) and bugs around non-constexpr inline variables and things like AnyMovable comparing std::type_info by pointer value

@@ -6,6 +6,16 @@ USERVER_NAMESPACE_BEGIN

namespace fs {

// Please, review this TempFile::TempFile implementation
// I simple added it as workaround for linkage error (if linked as shared library)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Simple: don't use shared linkage with userver

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why ? We already debugged shared library variant installation in this request and it works, here much reasons why 99% of libraries on unix systems install in shared variant. And here we try to make this variant available for userver ….

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are multiple reasons why we would like to avoid building shared libraries:

  • we guarantee no ABI stability even on minor changes. This is usually a deal breaker for shared libraries distributions
  • supporting shared libraries would double the testing efforts, double the support efforts, double the build scripts boilerplate and double the development efforts, as it would require -fvisibility=hidden and visibility attributes in code
  • LTO is not quite nicely supported with shared libraries, we would not like to provoke users for inefficient services

apolukhin added a commit that referenced this pull request Jul 1, 2023
@@ -147,6 +147,9 @@ function(generate_grpc_files)

set(did_generate_proto_sources FALSE)
if("${newest_proto_dependency}" IS_NEWER_THAN "${GENERATED_PROTO_DIR}/${path_base}.pb.cc")
# resolve root_path, proto_file to real path's - protoc check that root_path is prefix of proto_file (this can be non true if project inside folder sym linked to other dir)
get_filename_component(real_root_path ${root_path} REALPATH)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few lines above we already do this, so the root_path should be already a real path. Are we missing something?

Copy link

CLA Assistant Lite bot:
Thank you for your submission, we really appreciate it. Like many open-source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution. You can sign the CLA by just posting a Pull Request Comment same as the below format.


I hereby agree to the terms of the CLA available at: https://yandex.ru/legal/cla/


1 out of 2 committers have signed the CLA.
@yoori
@arbogdanov
You can retrigger this bot by commenting recheck in this Pull Request

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants