aboutsummaryrefslogtreecommitdiffstats
path: root/lib/stdlib/src/gen_server.erl
AgeCommit message (Collapse)Author
2018-11-30Filter gen_server State in crash sys:logRaimo Niskanen
2018-11-30Adjust sys:log(N, get) to documentationRaimo Niskanen
2018-11-30Unify system_events in gen_*Raimo Niskanen
2018-11-16Limit more error_logger termsRaimo Niskanen
2018-11-16Print sys:log in error reportRaimo Niskanen
2018-06-18Update copyright yearHenrik Nord
2018-06-08[logger] Change base OTP domain from [beam,erlang,otp] to [otp]Siri Hansen
2018-05-21Remove logger env vars for format_depth, max_size and utcSiri Hansen
These are replaced by new config handling and must not be used any more.
2018-04-27Update global name typespecDaniel Tipping
2018-04-26Start using logger internally in kernel and stdlibSiri Hansen
2018-03-02kernel,stdlib: Remove obsolete use of send with 'noconnect'Sverker Eriksson
as workarounds to avoid blocking auto-connect, which is now asynchronous in OTP-21. Also changed old catch to more efficient try-catch.
2018-02-06stdlib: Do not call erlang:get_stacktrace()Hans Bolinder
2017-09-07Merge branch 'maint'Siri Hansen
2017-09-05stdlib: add Unicode translation modifier in debug format funsSiri Hansen
This is now ok since sys opens the debug file with encoding utf8. Conflicts: lib/stdlib/src/gen_server.erl
2017-09-05stdlib : Improve handling of UnicodeHans Bolinder
2017-08-05Add {continue, Term} and handle_continue/2 to gen_serverJosé Valim
If the gen_server process needs to perform an action immediately after initialization or to break the execution of a callback into multiple steps, it can return {continue, term()} in place of the time-out or hibernation value, which will immediately invoke the handle_continue/2 callback with the given term. This provides a more accessible approach to after initialization compared to proc_lib+enter_loop that is also guaranteed to be safe. It also allows callbacks that need to do lengthy or stateful work to checkpoint the state throughout multiple iterations. This can be useful, for example, when implementing behaviours on top of gen_server.
2017-05-19Merge branch 'master' into jv-gen-server-exitsSiri Hansen
2017-05-18kernel: Introcude error_logger:get_format_depth()Hans Bolinder
2017-05-18stdlib: Limit the size of gen_server's error eventsHans Bolinder
The state of the gen_server is limited in error events before exiting (if the Kernel variable error_logger_format_depth is set). An alternative is to let the error_logger limit all messages (error_msg, format, warning_msg, info_msg), which would not limit reports and also add a smallish overhead to event logging. It is not decided if the alternative is to be implemented.
2017-05-15Do not discard stacktraces on gen_server exitsJosé Valim
Prior to this patch, the stacktrace of an error or exit in a callback would always be discarded in crash reports. For example, an exit(crashed) in handle_call/3 would emit: =CRASH REPORT==== 10-May-2017::14:15:50 === crasher: initial call: gen_server_SUITE:init/1 pid: <0.201.0> registered_name: [] exception exit: crashed in function gen_server:terminate/8 (src/gen_server.erl, line 828) Note that the stacktrace is pointing to the gen_server internal terminate implementation that calls exit/1. This patch uses erlang:raise/3 so the stacktrace is not lost, allowing proc_lib to show the class, reason and stacktrace coming from the user implementation (in this case gen_server_SUITE): =CRASH REPORT==== 10-May-2017::14:16:44 === crasher: initial call: gen_server_SUITE:init/1 pid: <0.197.0> registered_name: [] exception exit: crashed in function gen_server_SUITE:handle_call/3 (gen_server_SUITE.erl, line 1529) This change is completely backwards compatible as using erlang:raise/3 will still emit the same exit reason to any linked process and monitor as before.
2017-05-15Merge pull request #1407 from eltex-ecss/auto_hibernate_timeoutIngela Andin
Add option hibernate_after to gen_server, gen_statem and gen_event. Also added to the deprecated gen_fsm behaviour. OTP14405
2017-05-04Update copyright yearRaimo Niskanen
2017-05-02"auto_hibernate_timeout" option renamed to "hibernate_after".Anton N Ryabkov
It was done because "hibernate_after" option already used in ssl for the same reason.
2017-05-02Added reuse of code.Anton N Ryabkov
2017-05-02Added support of auto_hibernate_timeout option for gen_server, gen_fsm, ↵Anton N Ryabkov
gen_event process's. There is realized gen_server, gen_fsm, gen_event automatic hibernation functionality. Added unit tests for realized functionality. Added documentation for auto_hibernate_timeout option.
2017-04-21stdlib: Make gen_server callbacks optionalZandra Norman
2016-12-08Printout client stacktrace when a gen_server crashesHåkan Mattsson
When a gen_server crashes it is in many cases helpful to know in which context its client made its call.
2016-04-25Merge branch 'raimo/new-gen-state-machine/OTP-13065'Raimo Niskanen
* raimo/new-gen-state-machine/OTP-13065: (52 commits) Add section on state filtering Promote gen_statem over gen_fsm Modify code_change/4 to return CallbackMode Use ?NAME macro in examples Introduce Fred Herbert suggested additions Introduce corrections from Fred Hebert and Ingela Use .png pictures instead of .gif Write Design Principles chapter Fix missing short forms for event timeout Do more intricate Fred Hebert doc changes Change Caller -> From as suggested by Fred Hebert Do documentation improvements from Fred Hebert Fix broken documenation reference Rename state_timeout -> event_timeout Fix most of the system docs and emacs mode Change code_change/4 to {ok,State,Data} Fixup sharpened test suite Sharpen test suite Remove the remove_event action and all alike Relax caller() type check and cleanup ... Conflicts: lib/stdlib/src/gen.erl lib/stdlib/src/gen_event.erl lib/stdlib/src/gen_fsm.erl lib/stdlib/src/gen_server.erl lib/stdlib/test/error_logger_forwarder.erl
2016-03-15update copyright-yearHenrik Nord
2015-12-15Factor out common code to gen.erlRaimo Niskanen
2015-06-18Change license text to APLv2Bruce Yinhe
2014-11-28Merge branch 'maint'Siri Hansen
2014-11-18Add spec for gen_server:terminate/6,7Siri Hansen
This is to prevent dialyzer warning "no local return".
2014-11-11Merge branch 'maint'Peter Andersson
2014-11-07Add stack trace for gen_server exit in ERROR REPORTSiri Hansen
If a callback function was terminated with exit/1, there would be no stack trace in the ERROR REPORT produced by gen_server. This has been corrected. The actual exit reason for the process is not changed.
2014-09-15Remove untested option 'generic_debug' from gen_serverAnthony Ramine
This undocumented option makes an init:get_argument/1 call every time a gen_server is started. Reported-By: James Fish
2014-08-28Merge branch 'maint'Dan Gudmundsson
2014-07-04stdlib: Call format_status even if terminate callback crashesDan Gudmundsson
The format_status callback (if exists) should always be invoked when logging errors.
2014-05-26Add synchronous stop functions to gen_server and gen_fsmSiri Hansen
The functions utilize proc_lib:stop, which in turn utilizes sys:terminate.
2014-04-28Introduce the attribute -optional_callbacks in the context of behavioursHans Bolinder
2014-03-21fix sys:get_state/1,2 and sys:replace_state/2,3 when sys suspendedSteve Vinoski
Add two new system callbacks Module:system_get_state/1 and Module:system_replace_state/2 to allow sys:get_state/1,2 and sys:replace_state/2,3 to operate correctly even if a process is sys suspended. Modify gen_server, gen_fsm, and gen_event to support the new callbacks. If a callback module does not export these functions, then by default the Misc value (the same as that passed as the final argument to sys:handle_system_msg/6, and returned as part of the return value of sys:get_status/1,2) is treated as the callback module's state. The previous behaviour of intercepting the system message and passing a tuple of size 2 as the last argument to sys:handle_system_msg/6 is no longer supported. Add tests to verify the correctness of sys:get_state/1,2 and sys:replace_state/2,3 when processes are sys suspended. Add two tests for modules that implement special processes, one that exports system_get_state/1 and system_replace_state/2 and one that doesn't. Much of the credit for this patch goes to James Fish, who reported the initial problem and implemented much of the fix.
2013-10-15Merge branch 'maint'Fredrik Gustafsson
2013-10-12Change 'recive' to 'receive' in gen_server.erlBrian L. Troutwine
A small spelling correction merely; no functionality change.
2013-08-05Merge branch 'maint'Fredrik Gustafsson
2013-08-01Fix typo in abcast() function commentJohannes Weißl
2013-07-09Merge branch 'maint'Fredrik Gustafsson
2013-07-09Merge branch 'genrich/stdlib/gen_server_typo/OTP-11200' into maintFredrik Gustafsson
* genrich/stdlib/gen_server_typo/OTP-11200: handle_info Info type possible typo
2013-06-12Update copyright yearsBjörn-Egil Dahlberg
2013-06-08handle_info Info type possible typogenrich
Should it be 'timeout' instead of timeout(), as in doc: http://www.erlang.org/doc/man/gen_server.html#Module:handle_info-2?
2013-05-06Fix unmatched_returns warnings in STDLIB and KernelHans Bolinder